Azure / Azure/azure-rest-api-specs
az webapp commands failing on single character Resource Group
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
**Description**
`az webapp` cli commands are failing when using a resource group with a single character name.

> validation error: Parameter 'resource_group_name' must conform to the following pattern: '^[-\\w\\._\\(\\)]+[^\\.]$'.
**To Reproduce**
Create a resource group with single character name and try run webapp cli commands against it:
The following snippet reproduces error for me through Azure Cloud Shell.
```
az group create -l westus -n A
az webapp list -g A
#Returns validation error
```
**Expected behavior**
Webapp details to be returned
**Environment summary**
Tested using Azure Portal Cloud Shell:
owen@Azure:~$ az --version
azure-cli 2.0.69
command-modules-nspkg 2.0.3
core 2.0.69
nspkg 3.0.4
telemetry 1.0.3
Python location '/opt/az/bin/python3'
Extensions directory '/home/owen/.azure/cliextensions'
Python (Linux) 3.6.5 (default, Jul 11 2019, 08:40:03)
[GCC 5.4.0 20160609]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
**Additional context**
Debug output
owen@Azure:~$ az webapp show -g B --name mywebappinrgb --debug
Command arguments: ['webapp', 'show', '-g', 'B', '--name', 'mywebappinrgb', '--debug']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [, , ]
Event: CommandInvoker.OnPreCommandTableCreate []
Installed command modules ['acr', 'acs', 'advisor', 'ams', 'appconfig', 'appservice', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentmanager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotcentral', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'monitor', 'natgateway', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
Loaded module 'acr' in 0.015 seconds.
Loaded module 'acs' in 0.003 seconds.
Loaded module 'advisor' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'ams' in 0.006 seconds.
Loaded module 'appconfig' in 0.002 seconds.
Loaded module 'appservice' in 0.008 seconds.
Loaded module 'backup' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'batch' in 0.009 seconds.
Loaded module 'batchai' in 0.003 seconds.
Loaded module 'billing' in 0.002 seconds.
Loaded module 'botservice' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'cdn' in 0.002 seconds.
Loaded module 'cloud' in 0.001 seconds.
Loaded module 'cognitiveservices' in 0.002 seconds.
Loaded module 'configure' in 0.001 seconds.
Loaded module 'consumption' in 0.002 seconds.
Loaded module 'container' in 0.002 seconds.
Loaded module 'cosmosdb' in 0.004 seconds.
Loaded module 'deploymentmanager' in 0.002 seconds.
Loaded module 'dla' in 0.005 seconds.
Loaded module 'dls' in 0.003 seconds.
Loaded module 'dms' in 0.003 seconds.
Loaded module 'eventgrid' in 0.003 seconds.
Loaded module 'eventhubs' in 0.004 seconds.
Loaded module 'extension' in 0.001 seconds.
Loaded module 'feedback' in 0.001 seconds.
Loaded module 'find' in 0.001 seconds.
Loaded module 'hdinsight' in 0.003 seconds.
Loaded module 'interactive' in 0.001 seconds.
Loaded module 'iot' in 0.005 seconds.
Loaded module 'iotcentral' in 0.001 seconds.
Loaded module 'keyvault' in 0.007 seconds.
Loaded module 'kusto' in 0.002 seconds.
Loaded module 'lab' in 0.004 seconds.
Loaded module 'managedservices' in 0.001 seconds.
Loaded module 'maps' in 0.001 seconds.
Loaded module 'monitor' in 0.005 seconds.
Loaded module 'natgateway' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'netappfiles' in 0.003 seconds.
Loaded module 'network' in 0.030 seconds.
Loaded module 'policyinsights' in 0.002 seconds.
Loaded module 'privatedns' in 0.006 seconds.
Loaded module 'profile' in 0.001 seconds.
Loaded module 'rdbms' in 0.006 seconds.
Loaded module 'redis' in 0.002 seconds.
Loaded module 'relay' in 0.003 seconds.
Loaded module 'reservations' in 0.002 seconds.
Loaded module 'resource' in 0.007 seconds.
Loaded module 'role' in 0.006 seconds.
Loaded module 'search' in 0.002 seconds.
Loaded module 'security' in 0.003 seconds.
Loaded module 'servicebus' in 0.006 seconds.
Loaded module 'servicefabric' in 0.003 seconds.
Loaded module 'signalr' in 0.001 seconds.
Loaded module 'sql' in 0.008 seconds.
Loaded module 'sqlvm' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'storage' in 0.032 seconds.
Loaded module 'vm' in 0.015 seconds.
Loaded all modules in 0.266 seconds. (note: there's always an overhead with the first module loaded)
Extensions directory: '/home/owen/.azure/cliextensions'
Event: CommandInvoker.OnPreCommandTableTruncate []
az_command_data_logger : command args: webapp show -g {} --name {} --debug
metadata file logging enabled - writing logs to '/home/owen/.azure/commands'.
Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x7fd94826b2f0>]
Event: CommandInvoker.OnPostArgumentLoad []
Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x7fd94826b730>, .add_cache_arguments at 0x7fd94826b8c8>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs []
Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x7fd94826b7b8>, ]
Getting management service client client_type=WebSiteManagementClient
msrest.universal_http.requests : Configuring retry: max_retries=4, backoff_factor=0.8, max_backoff=90
msrest.exceptions : Parameter 'resource_group_name' must conform to the following pattern: '^[-\\w\\._\\(\\)]+[^\\.]$'.
cli.azure.cli.core.util : validation error: Parameter 'resource_group_name' must conform to the following pattern: '^[-\\w\\._\\(\\)]+[^\\.]$'.
validation error: Parameter 'resource_group_name' must conform to the following pattern: '^[-\\w\\._\\(\\)]+[^\\.]$'.
az_command_data_logger : exit code: 1
telemetry.save : Save telemetry record of length 2430 in cache
telemetry.check : Negative: The /home/owen/.azure/telemetry.txt was modified at 2019-07-20 21:08:00.077161, which in less than 600.000000 s
command ran in 0.603 seconds.
Contributor guide
Research direction
Start by reproducing the failure with `az group create -l westus -n A` followed by `az webapp list -g A`, and compare it with the failing `az webapp show` command in the debug output. Trace the `resource_group_name` validation pattern used by the WebSiteManagementClient; done means single-character resource group names are accepted and webapp details are returned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100