Skip to content

az network vnet subnet show mangles case in ipConfiguration array output #30562

@Waiver-Wire-Addict

Description

@Waiver-Wire-Addict

Describe the bug

Azure CLI Version: AZURECLI/2.67.0 (DEB) azsdk-python-core/1.31.0 Python/3.12.7 (Linux-6.8.0-51-generic-x86_64-with-glibc2.39
API Version: 2022-01-01

After running commands to gather data about this bug, it does not appear to be a bug in the AZ CLI, but in the REST API endpoint this command calls.

Adding a --debug flag to the command shows the REST API output has the mangled case.

I am hoping that someone on the AZ CLI team will raise the appropriate REST API issue - I just want to use the AZ CLI.

When you run:

az login
az network vnet subnet show -g "TheRG" -n "TheSubNetName" --vnet-name "TheVNetName"

In the "ipConfigurations" array of the JSON output, each object representing an ipConfiguration has an incorrect "id", which has 3 sub-fields in the id forced to uppercase.

The sub-fields:
ResourceGroup
NicName
IpConfigurationName

have all been forced to uppercase, losing the correct casing present in the particular names.

Here is a fictitious example, in this example Bold indicates correct casing and BoldItalic incorrect casing.

SubscriptionID: ffffffff-ffff-ffff-ffff-ffffffffffff
VNET Name: TheVNetName
SubNet Name: TheSubNetName
ResourceGroup: TheRG
NicName: TheNicName
IpConfigurationName: TheIpConfigurationName

Issuing the commands:

az login
az network vnet subnet show -g "TheRG" -n "TheSubNetName" --vnet-name "TheVNetName"

will produce the following incorrect output in the "ipConfigurations" array:

"ipConfigurations": [
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/THERG/providers/Microsoft.Network/networkInterfaces/THENICNAME/ipConfigurations/THEIPCONFIGURATIONNAME",
"resourceGroup": "THERG"
}
]

This is significant because if one uses the ipConfiguration id and parses the sub-fields from it to get:

ResourceGroup: THERG
NicName: THENICNAME
IpConfigurationName: THEIPCONFIGURATIONNAME

and uses those values to try and retrieve the ipConfiguration JSON with the following command:

az network nic ip-config show -g THERG -n THEIPCONFIGURATIONNAME --nic-name THENICNAME

the command fails with:

ERROR: ResourceNotFoundError

However the command with the correct casing for the 3 values such as this:

az network nic ip-config show -g TheRG -n TheIpConfigurationName --nic-name TheNicName

succeeds.

Related command

Imaginary Subscription State:

SubscriptionID: ffffffff-ffff-ffff-ffff-ffffffffffff
VNET Name: TheVNetName
SubNet Name: TheSubNetName
ResourceGroup: TheRG
NicName: TheNicName
IpConfigurationName: TheIpConfigurationName

Command with bad output:

az login
az network vnet subnet show -g "TheRG" -n "TheSubNetName" --vnet-name "TheVNetName"

Bad Output:
"ipConfigurations": [
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/THERG/providers/Microsoft.Network/networkInterfaces/THENICNAME/ipConfigurations/THEIPCONFIGURATIONNAME",
"resourceGroup": "THERG"
}
]

Command that generates an error showing that the output is incorrect using values parsed from the bad output:

az network nic ip-config show -g THERG -n THEIPCONFIGURATIONNAME --nic-name THENICNAME

Command that succeeds showing what the parsed values would be if they were correct.

az network nic ip-config show -g TheRG -n TheIpConfigurationName --nic-name TheNicName

Errors

The command succeeds, but its output is incorrect. The output can not be parsed to retrieve sub-fields that can be use to issue commands to gather further information.

The output has 3 fields with the casing of the fields forced to uppercase.

This casing to being forced to uppercase seems to be occurring at the REST API, since a --debug command shows the incorrect casing in the REST API response.

Issue script & Debug output

az network vnet subnet show -g "TheRG" -n "TheSubNetName" --vnet-name "TheVNetName" --debug

will show that the case for the ResourceGroup in the ipConfiguration object id sub-field has been forced to uppercase in the REST API response.

Expected behavior

Imaginary Subscription State:

SubscriptionID: ffffffff-ffff-ffff-ffff-ffffffffffff
VNET Name: TheVNetName
SubNet Name: TheSubNetName
ResourceGroup: TheRG
NicName: TheNicName
IpConfigurationName: TheIpConfigurationName

Bad Output:
"ipConfigurations": [
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/THERG/providers/Microsoft.Network/networkInterfaces/THENICNAME/ipConfigurations/THEIPCONFIGURATIONNAME",
"resourceGroup": "THERG"
}
]

Good Output:
"ipConfigurations": [
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TheRG/providers/Microsoft.Network/networkInterfaces/TheNicName/ipConfigurations/TheIpConfigurationName",
"resourceGroup": "TheRG"
}
]

Environment Summary

azure-cli 2.67.0

core 2.67.0
telemetry 1.1.0

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/home/co-user/.azure/cliextensions'

Python (Linux) 3.12.7 (main, Nov 13 2024, 04:06:34) [GCC 13.2.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Assignees

Labels

Accountaz login/accountAuto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamNetworkaz network vnet/lb/nic/dns/etc...OKR CandidateThis label is used to track how many GitHub issues we have resolved for OKR purpose.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackMore information is needed from author to address the issue.no-recent-activityThere has been no recent activity on this issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions