Azure / Azure/azure-cli

az network vnet subnet show command errors when using the correct VNET name

Open
#26,343 4 comments 0 reactions 1 assignee Claimed by @necusjz View on GitHub
act-quality-productivity-squad Auto-Assign Azure CLI Team customer-reported feature-request Network
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug

az network vnet subnet show command errors when using the correct VNET name. I am able to obtain a "resource not found" response when using an incorrect VNET name which is 100% expected. But any time using the correct name the same python error messages occur. I have tried this in multiple subscriptions and on multiple resource groups and vnets.

The actual vnet name consists of 25 mixed case alphanumeric characters and ends in number.

**Command Name**
`az network vnet subnet show`

**Errors:**
```
The command failed with an unexpected error. Here is the traceback:
option values must be strings
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 680, in execute
self.cli_ctx.save_local_context(parsed_args, self.commands_loader.command_table[command].arguments,
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/__init__.py", line 154, in save_local_context
self.local_context.set(lca.scopes, lca.name, value)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/local_context.py", line 116, in set
self._local_context_file.set_value(scope.lower(), argument, value)
File "/usr/lib64/az/lib/python3.9/site-packages/knack/config.py", line 239, in set_value
config.set(section, option, value)
File "/usr/lib/python3.9/configparser.py", line 1203, in set
self._validate_value_types(option=option, value=value)
File "/usr/lib/python3.9/configparser.py", line 1188, in _validate_value_types
raise TypeError("option values must be strings")
TypeError: option values must be stringsc.
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- _Put any pre-requisite steps here..._
- `az network vnet subnet show --resource-group mygroupname --name mysubnet --vnet-name bad-vnet-name
## Expected Behavior
Works as expected when using an incorrect VNET name: see response below

(ResourceNotFound) The Resource 'Microsoft.Network/virtualNetworks/bad-vnet-name' under resource group 'mygroupname' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.Network/virtualNetworks/bad-vnet-name' under resource group 'mygroupname' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- _Put any pre-requisite steps here..._
- `az network vnet subnet show --resource-group mygroupname --name mysubnet --vnet-name correct-vnet-name
## Expected Behavior
Does not work when using the correct VNET name
See error message above

## Environment Summary
```
Linux-5.4.0-1107-azure-x86_64-with-glibc2.35 (Cloud Shell), CBL-Mariner/Linux
Python 3.9.14
Installer: RPM

azure-cli 2.48.1

Extensions:
ai-examples 0.2.5
ml 2.15.1
ssh 1.1.6

Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
```
## Additional Context
Microsoft Edge
Version 112.0.1722.68 (Official build) (64-bit)

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.