Operation returned an invalid status 'Bad Request' when trying to set a custom domain
See original GitHub issue
az feedback
auto-generates most of the information requested below, as of CLI version 2.0.62
Describe the bug
To Reproduce
Run az staticwebapp hostname set -n jamcloud --hostname blog.domain.com
returns Operation returned an invalid status ‘Bad Request’
cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {“Code”:“BadRequest”,“Message”:“The maximum number of custom domains allowed for this static site is 2.”,“Target”:null,“Details”:[{“Message”:“The maximum number of custom domains allowed for this static site is 2.”},{“Code”:“BadRequest”},{“ErrorEntity”:{“ExtendedCode”:“59334”,“MessageTemplate”:“The maximum number of custom domains allowed for this static site is {0}.”,“Parameters”:[“2”],“Code”:“BadRequest”,“Message”:“The maximum number of custom domains allowed for this static site is 2.”}}],“Innererror”:null} cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception: cli.azure.cli.core.util: Traceback (most recent call last): File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/knack/cli.py”, line 231, in invoke cmd_result = self.invocation.execute(args) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 658, in execute raise ex File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 721, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 692, in _run_job result = cmd_copy(params) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py”, line 328, in call return self.handler(*args, **kwargs) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py”, line 121, in handler return op(**command_args) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/appservice/static_sites.py”, line 117, in set_staticsite_domain return sdk_no_wait(no_wait, client.begin_create_or_update_static_site_custom_domain, File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/cli/core/util.py”, line 678, in sdk_no_wait return func(*args, **kwargs) File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py”, line 2464, in begin_create_or_update_static_site_custom_domain raw_result = self._create_or_update_static_site_custom_domain_initial( File “/opt/homebrew/Cellar/azure-cli/2.32.0/libexec/lib/python3.10/site-packages/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py”, line 2409, in _create_or_update_static_site_custom_domain_initial raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError: Operation returned an invalid status ‘Bad Request’
cli.azure.cli.core.azclierror: Operation returned an invalid status ‘Bad Request’ az_command_data_logger: Operation returned an invalid status ‘Bad Request’
Expected behavior
We should include the error message “The maximum number of custom domains allowed for this static site is 2.”
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
The error here is that the quota has reached “The maximum number of custom domains allowed for this static site is 2.” @StrawnSC can we show the detailed error message by default on SWA command?
The same goes for
az staticwebapp create
where the error message isRepositoryToken is invalid. Please ensure the repository exists and the RepositoryToken is for an admin of the repository.
This also only outputs
Bad Request
.