Azure / Azure/azure-cli-extensions

Broken idempotency for az webapp config access-restriction add --service-tag

Open
#8,271 1 comment 0 reactions 0 assignees View on GitHub
App Services Auto-Assign bug customer-reported extension/webapp Service Attention Web Apps
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

### Describe the bug

When running a command for adding a app service restriction for a service tag twice, there will be an error.

### Related command

`az webapp config access-restriction add -g ResourceGroup -n AppServiceName --priority 100 --scm-site --service-tag AzureCloud`

### Errors

Service Tag: AzureCloud already exists. Cannot add duplicate Service Tag values.

### Issue script & Debug output

DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 654, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/invocation.py", line 113, in _validation
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 921, in _validate_arg_level
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/_validators.py", line 334, in validate_service_tag
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/_validators.py", line 375, in _validate_service_tag_existence
azure.cli.core.azclierror.ArgumentUsageError: Service Tag: AzureCloud already exists. Cannot add duplicate Service Tag values.

ERROR: cli.azure.cli.core.azclierror: Service Tag: AzureCloud already exists. Cannot add duplicate Service Tag values.
ERROR: az_command_data_logger: Service Tag: AzureCloud already exists. Cannot add duplicate Service Tag values.
DEBUG: cli.knack.cli: Event: Cli.PostExecute []
INFO: az_command_data_logger: exit code: 1
INFO: cli.__main__: Command ran in 8.079 seconds (init: 0.410, invoke: 7.669)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 3917 in cache file under C:\Users\user\.azure\telemetry\20241113135510233
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\user\.azure C:\Users\user\.azure\telemetry\20241113135510233"
INFO: telemetry.process: Return from creating process 9200
INFO: telemetry.main: Finish creating telemetry upload process.

### Expected behavior

The command should be idempotent and not generate errors.

### Environment Summary

azure-cli 2.66.0

core 2.66.0
telemetry 1.1.0

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

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

Python (Windows) 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### 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.