Skip to content

[App Service] az webapp config appsettings set: Fix SyntaxWarning invalid decimal literal#32136

Merged
yanzhudd merged 6 commits intoAzure:devfrom
seligj95:09172025
Sep 29, 2025
Merged

[App Service] az webapp config appsettings set: Fix SyntaxWarning invalid decimal literal#32136
yanzhudd merged 6 commits intoAzure:devfrom
seligj95:09172025

Conversation

@seligj95
Copy link
Copy Markdown
Contributor

Related command

az webapp config appsettings set
az webapp deployment container show-cd-url

Description

Validation was causing false-positive error message to be displayed in command output. Updated logic to only validate when needed.
Also updated help text for an unrelated command.

Fixes: #32097
Fixes: #32084

Testing Guide

az webapp config appsettings set -n -g --settings TestKey=6in --> should not display SyntaxWarning anymore
az webapp deployment container show-cd-url -n -g --> help text updated to make it clear that Basic Auth needs to be enabled in order to view the un-redacted URL

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

Fixes Azure#32084

When using 'az webapp config appsettings set' with values like 'TestKey=6in',
users were seeing SyntaxWarning: invalid decimal literal. This was happening
because the code was trying to parse simple key=value pairs through
ast.literal_eval(), which interprets '6in' as an invalid numeric literal.

The fix adds a fast-path for simple key=value pairs that avoids calling
shell_safe_json_parse (and thus ast.literal_eval) when the input clearly
looks like a simple assignment rather than JSON or Python dict syntax.

Changes:
- Added detection for simple key=value patterns
- Parse them directly with split() to avoid ast.literal_eval warnings
- Preserve existing functionality for JSON and file input (@file)
- Fall back to original parsing logic for complex cases

Tested with values like 'TestKey=6in', 'AnotherKey=7in' that previously
caused warnings. The fix eliminates the warnings while maintaining
full compatibility with existing JSON and file-based input methods.
Copilot AI review requested due to automatic review settings September 17, 2025 16:31
@seligj95 seligj95 requested a review from yanzhudd as a code owner September 17, 2025 16:31
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Sep 17, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Sep 17, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Sep 17, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a SyntaxWarning issue in the az webapp config appsettings set command that was causing false-positive error messages when setting simple key=value pairs. The fix adds early detection for basic key=value syntax to avoid unnecessary JSON parsing that triggered warnings.

  • Adds pre-validation logic to handle simple key=value pairs without invoking JSON parsing
  • Updates help text for container webhook URL command to clarify Basic Auth requirement

Reviewed Changes

Copilot reviewed 2 out of 6 changed files in this pull request and generated 2 comments.

File Description
src/azure-cli/azure/cli/command_modules/appservice/custom.py Adds early parsing for simple key=value pairs to avoid SyntaxWarning from JSON parser
src/azure-cli/azure/cli/command_modules/appservice/_help.py Updates help text to clarify Basic Auth requirement for webhook URL

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/appservice/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/custom.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@seligj95 seligj95 changed the title [App Service] az webapp config appsettings set: Fix SyntaxWarning: invalid decimal literal [App Service] az webapp config appsettings set: Fix SyntaxWarning invalid decimal literal Sep 17, 2025
@yanzhudd
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd yanzhudd merged commit 704326a into Azure:dev Sep 29, 2025
48 checks passed
@seligj95 seligj95 deleted the 09172025 branch October 15, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Web Apps az webapp

Projects

None yet

5 participants