Azure / Azure/azure-cli

`az apim nv` doesn't provide parameters for configuring Key Vault secrets

Open
#27,822 8 comments 1 reaction 0 assignees View on GitHub
act-observability-squad API Management Auto-Assign Auto-Resolve bug Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

When using the Azure CLI, it is not currently possible to configure a named variable within API Management that uses Azure Key Vault secret values.

This functionality exists at the REST API [documented here](https://learn.microsoft.com/en-us/rest/api/apimanagement/named-value/create-or-update?view=rest-apimanagement-2022-08-01&tabs=HTTP#keyvaultcontractcreateproperties) but appears to be missing as a parameter in the CLI specifically.

### Related command

`az apim nv`

### Errors

ERROR: unrecognized arguments: --keyvault {

Examples from AI knowledge base:
az apim nv create --service-name MyApim --resource-group MyResourceGroup --named-value-id MyNamedValue --display-name 'My Named Value' --value 'foo'
Create a Named Value.

az apim nv create --display-name 'My Named Value' --named-value-id MyNamedValue --resource-group MyResourceGroup --secret true --service-name MyApim --value 'foo'
Create an API Management Named Value. (autogenerated)

https://docs.microsoft.com/en-US/cli/azure/apim/nv#az_apim_nv_create
Read more about the command in reference docs

### Issue script & Debug output

```
$keyVaultContract = @{
identityClientId = $managedIdentityClientId
secretIdentifier = $secretIdentifier
} | ConvertTo-Json

az apim nv create --resource-group $resourceGroup --service-name $apiManagement --named-value-id $nvName --display-name $nvName --keyvault $keyVaultContract --debug
```

ERROR: unrecognized arguments: --keyvault {

Examples from AI knowledge base:
az apim nv create --service-name MyApim --resource-group MyResourceGroup --named-value-id MyNamedValue --display-name 'My Named Value' --value 'foo'
Create a Named Value.

az apim nv create --display-name 'My Named Value' --named-value-id MyNamedValue --resource-group MyResourceGroup --secret true --service-name MyApim --value 'foo'
Create an API Management Named Value. (autogenerated)

https://docs.microsoft.com/en-US/cli/azure/apim/nv#az_apim_nv_create
Read more about the command in reference docs

### Expected behavior

When providing a Key Vault contract object as described in the REST API documentation for API Management named variables, the CLI should accept this value and configure the named variable in Azure.

### Environment Summary

azure-cli 2.53.0 *

core 2.53.0 *
telemetry 1.1.0

Extensions:
resource-graph 2.1.0

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\jamescroft\.azure\cliextensions'

Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.