Skip to content

[App Service] Fix #18697: az webapp config ssl create: Add --wait flag for managed certificate automation#33068

Closed
seligj95 wants to merge 1 commit intoAzure:devfrom
seligj95:fix/18697-ssl-create-wait
Closed

[App Service] Fix #18697: az webapp config ssl create: Add --wait flag for managed certificate automation#33068
seligj95 wants to merge 1 commit intoAzure:devfrom
seligj95:fix/18697-ssl-create-wait

Conversation

@seligj95
Copy link
Contributor

Description

Fixes #18697

Problem

az webapp config ssl create has a hard 2-minute polling timeout for managed certificate creation. When the operation takes longer, the command silently returns None, making it impossible for automation scripts to reliably chain ssl bind after ssl create.

Solution

Add a --wait flag that:

  • Extends polling timeout from 2 minutes to 10 minutes
  • Raises a CLIError on timeout instead of silently returning None
  • Enables automation scripts to reliably detect success/failure

Default behavior (without --wait) is unchanged — still 2-minute timeout with a warning message.

Usage

# Wait for cert creation (up to 10 min), error on timeout
az webapp config ssl create -g MyRG -n MyApp --hostname my.domain.com --wait

# Chain with ssl bind in automation
az webapp config ssl create -g MyRG -n MyApp --hostname my.domain.com --wait && \
  az webapp config ssl bind -g MyRG -n MyApp --certificate-thumbprint <thumbprint> --ssl-type SNI

Testing

  • Added 2 unit tests for the new --wait behavior (timeout raises error, no-wait returns None)
  • All existing tests pass unchanged

…wait` flag for managed certificate automation

When --wait is set:
- Extends polling timeout from 2 minutes to 10 minutes
- Raises CLIError on timeout instead of silently returning None
- Enables automation scripts to reliably chain ssl bind after ssl create

Default behavior (without --wait) is unchanged: 2-minute timeout with warning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 26, 2026 14:54
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 26, 2026

️✔️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
️✔️postgresql
️✔️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

Hi @seligj95,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

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

azure-client-tools-bot-prd bot commented Mar 26, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️appservice
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd functionapp config ssl create cmd functionapp config ssl create added parameter wait
⚠️ 1006 - ParaAdd webapp config ssl create cmd webapp config ssl create added parameter wait

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 26, 2026

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

@github-actions
Copy link

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

Adds an opt-in --wait flag to improve automation reliability for App Service managed certificate creation by extending polling and surfacing timeouts as errors (instead of returning None).

Changes:

  • Extend managed cert polling timeout from 2 minutes to 10 minutes when --wait is specified, and raise CLIError on timeout.
  • Add --wait parameter wiring for config ssl create.
  • Add unit tests covering timeout behavior for wait=True (error) vs wait=False (returns None).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/azure-cli/azure/cli/command_modules/appservice/custom.py Adds wait parameter to managed cert creation polling and raises on timeout when opted-in.
src/azure-cli/azure/cli/command_modules/appservice/_params.py Introduces --wait flag for config ssl create argument context.
src/azure-cli/azure/cli/command_modules/appservice/_help.py Documents --wait via an additional example for webapp config ssl create.
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py Adds unit tests validating new timeout behavior with and without --wait.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +526
c.argument('wait', options_list=['--wait'], action='store_true', default=False,
help='Wait up to 10 minutes for the certificate to be created. '
'Returns an error if creation times out instead of silently returning.')
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

wait is being added inside the for scope in ['webapp', 'functionapp'] loop, so --wait will also become available on az functionapp config ssl create (and will map into create_managed_ssl_cert). If this PR is intended to be webapp-only, scope this argument to webapp instead; if it’s intended to support functionapps too, please update functionapp help/examples (and ideally add coverage) to reflect the new flag.

Suggested change
c.argument('wait', options_list=['--wait'], action='store_true', default=False,
help='Wait up to 10 minutes for the certificate to be created. '
'Returns an error if creation times out instead of silently returning.')
if scope == 'webapp':
c.argument('wait', options_list=['--wait'], action='store_true', default=False,
help='Wait up to 10 minutes for the certificate to be created. '
'Returns an error if creation times out instead of silently returning.')

Copilot uses AI. Check for mistakes.
c.argument('resource-group', options_list=['--resource-group', '-g'], help='Name of resource group.')
c.argument('wait', options_list=['--wait'], action='store_true', default=False,
help='Wait up to 10 minutes for the certificate to be created. '
'Returns an error if creation times out instead of silently returning.')
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

The --wait help text ends with “instead of silently returning.” but doesn’t say what’s returned (it’s None). Consider clarifying this to “silently returning None/no result” so automation users understand the default behavior precisely.

Suggested change
'Returns an error if creation times out instead of silently returning.')
'Returns an error if creation times out instead of silently returning None (no result).')

Copilot uses AI. Check for mistakes.
Comment on lines +6012 to 6019
if wait:
raise CLIError("Managed Certificate creation for '{}' timed out after {} minutes. "
"Check status with 'az webapp config ssl show -g {} "
"--certificate-name {}'.".format(hostname, poll_timeout_minutes,
resource_group_name, certificate_name))
logger.warning("Managed Certificate creation in progress. Please use the command "
"'az webapp config ssl show -g %s --certificate-name %s' "
" to view your certificate once it is created", resource_group_name, certificate_name)
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

This timeout error hardcodes az webapp config ssl show ..., but create_managed_ssl_cert is also used by functionapp config ssl create (see commands.py). If --wait is exposed for functionapps (currently it is via _params.py), the guidance/error message should be accurate for both command groups (e.g., mention both webapp and functionapp, or avoid hardcoding the group).

Suggested change
if wait:
raise CLIError("Managed Certificate creation for '{}' timed out after {} minutes. "
"Check status with 'az webapp config ssl show -g {} "
"--certificate-name {}'.".format(hostname, poll_timeout_minutes,
resource_group_name, certificate_name))
logger.warning("Managed Certificate creation in progress. Please use the command "
"'az webapp config ssl show -g %s --certificate-name %s' "
" to view your certificate once it is created", resource_group_name, certificate_name)
app_type = 'functionapp' if is_functionapp(cmd, resource_group_name, name) else 'webapp'
if wait:
raise CLIError("Managed Certificate creation for '{}' timed out after {} minutes. "
"Check status with 'az {} config ssl show -g {} "
"--certificate-name {}'.".format(hostname, poll_timeout_minutes,
app_type, resource_group_name, certificate_name))
logger.warning("Managed Certificate creation in progress. Please use the command "
"'az %s config ssl show -g %s --certificate-name %s' "
" to view your certificate once it is created", app_type, resource_group_name,
certificate_name)

Copilot uses AI. Check for mistakes.
@seligj95
Copy link
Contributor Author

Consolidated into #33058

@seligj95 seligj95 closed this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebApp: az webapp config ssl create - managed certificate

4 participants