Skip to main content
Glama

Azure MCP Server

Official
MIT License
1,161
  • Linux
  • Apple
KeyValueUnlockCommand.cs2.45 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using AzureMcp.AppConfig.Options.KeyValue; using AzureMcp.AppConfig.Services; using AzureMcp.Core.Commands; using AzureMcp.Core.Services.Telemetry; using Microsoft.Extensions.Logging; namespace AzureMcp.AppConfig.Commands.KeyValue; public sealed class KeyValueUnlockCommand(ILogger<KeyValueUnlockCommand> logger) : BaseKeyValueCommand<KeyValueUnlockOptions>() { private const string CommandTitle = "Unlock App Configuration Key-Value Setting"; private readonly ILogger<KeyValueUnlockCommand> _logger = logger; public override string Name => "unlock"; public override string Description => """ Unlock a key-value setting in an App Configuration store. This command removes the read-only mode from a key-value setting, allowing modifications to its value. You must specify an account name and key. Optionally, you can specify a label to unlock a specific labeled version of the setting, otherwise the setting with the default label will be unlocked. """; public override string Title => CommandTitle; public override ToolMetadata Metadata => new() { Destructive = false, ReadOnly = false }; public override async Task<CommandResponse> ExecuteAsync(CommandContext context, ParseResult parseResult) { var options = BindOptions(parseResult); try { if (!Validate(parseResult.CommandResult, context.Response).IsValid) { return context.Response; } var appConfigService = context.GetService<IAppConfigService>(); await appConfigService.UnlockKeyValue( options.Account!, options.Key!, options.Subscription!, options.Tenant, options.RetryPolicy, options.Label); context.Response.Results = ResponseResult.Create( new KeyValueUnlockResult(options.Key, options.Label), AppConfigJsonContext.Default.KeyValueUnlockResult); } catch (Exception ex) { _logger.LogError(ex, "An exception occurred unlocking key. Key: {Key}.", options.Key); HandleException(context, ex); } return context.Response; } internal record KeyValueUnlockResult(string? Key, string? Label); }

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