Skip to main content
Glama

Azure MCP Server

Official
MIT License
1,161
  • Linux
  • Apple
QuotaService.cs2.83 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Azure.Core; using Azure.ResourceManager; using AzureMcp.Core.Services.Azure; using AzureMcp.Core.Services.Http; using AzureMcp.Quota.Models; using AzureMcp.Quota.Services.Util; using Microsoft.Extensions.Logging; namespace AzureMcp.Quota.Services; public class QuotaService(ILoggerFactory? loggerFactory = null, IHttpClientService? httpClientService = null) : BaseAzureService(loggerFactory: loggerFactory), IQuotaService { private readonly IHttpClientService _httpClientService = httpClientService ?? throw new ArgumentNullException(nameof(httpClientService)); public async Task<Dictionary<string, List<UsageInfo>>> GetAzureQuotaAsync( List<string> resourceTypes, string subscriptionId, string location) { TokenCredential credential = await GetCredential(); Dictionary<string, List<UsageInfo>> quotaByResourceTypes = await AzureQuotaService.GetAzureQuotaAsync( credential, resourceTypes, subscriptionId, location, LoggerFactory, _httpClientService ); return quotaByResourceTypes; } public async Task<List<string>> GetAvailableRegionsForResourceTypesAsync( string[] resourceTypes, string subscriptionId, string? cognitiveServiceModelName = null, string? cognitiveServiceModelVersion = null, string? cognitiveServiceDeploymentSkuName = null) { ArmClient armClient = await CreateArmClientAsync(); // Create cognitive service properties if any of the parameters are provided CognitiveServiceProperties? cognitiveServiceProperties = null; if (!string.IsNullOrWhiteSpace(cognitiveServiceModelName) || !string.IsNullOrWhiteSpace(cognitiveServiceModelVersion) || !string.IsNullOrWhiteSpace(cognitiveServiceDeploymentSkuName)) { cognitiveServiceProperties = new CognitiveServiceProperties { ModelName = cognitiveServiceModelName, ModelVersion = cognitiveServiceModelVersion, DeploymentSkuName = cognitiveServiceDeploymentSkuName }; } var availableRegions = await AzureRegionService.GetAvailableRegionsForResourceTypesAsync(armClient, resourceTypes, subscriptionId, LoggerFactory, cognitiveServiceProperties); var allRegions = availableRegions.Values .Where(regions => regions.Count > 0) .SelectMany(regions => regions) .Distinct() .ToList(); List<string> commonValidRegions = availableRegions.Values .Aggregate((current, next) => current.Intersect(next).ToList()); return commonValidRegions; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Azure/azure-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server