Skip to content

az cdn endpoint create does not work in Azure China - "Custom domain must be specified for endpoint creation" #31268

@AHarman

Description

@AHarman

Describe the bug

I've tried making this change via Terraform and, when that didn't work I moved to the Azure CLI. I raised an issue with the Terraform provider here: hashicorp/terraform-provider-azurerm#29331

I had to down grade to version 2.57.0 as this is the latest version supported by Azure China.

When trying to create a CDN endpoint with the following command:

az cdn endpoint create -g my-group -n example-endpoint --profile-name my-profile --origin contoso.com

The response:

ERROR: (BadRequest) Custom domain must be specified for endpoint creation.
Code: BadRequest
Message: Custom domain must be specified for endpoint creation.

Related command

az cdn endpoint create

Errors

ERROR: (BadRequest) Custom domain must be specified for endpoint creation.
Code: BadRequest
Message: Custom domain must be specified for endpoint creation.

Issue script & Debug output

az cdn endpoint create -g my-group -n example-endpoint --profile-name my-profile --origin contoso.com

output:

DEBUG: cli.azure.cli.core.sdk.policies: Response content:
DEBUG: cli.azure.cli.core.sdk.policies: {
  "error": {
    "code": "BadRequest",
  File "/home/vsts/.local/lib/python3.12/site-packages/azure/cli/command_modules/cdn/custom/custom.py", line 700, in create_endpoint
    return sdk_no_wait(no_wait, client.endpoints.begin_create, resource_group_name, profile_name, name, endpoint)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vsts/.local/lib/python3.12/site-packages/azure/cli/core/util.py", line 710, in sdk_no_wait
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vsts/.local/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vsts/.local/lib/python3.12/site-packages/azure/mgmt/cdn/operations/_endpoints_operations.py", line 729, in begin_create
    raw_result = self._create_initial(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vsts/.local/lib/python3.12/site-packages/azure/mgmt/cdn/operations/_endpoints_operations.py", line 669, in _create_initial
    raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (BadRequest) Custom domain must be specified for endpoint creation.
Code: BadRequest
Message: Custom domain must be specified for endpoint creation.

ERROR: cli.azure.cli.core.azclierror: (BadRequest) Custom domain must be specified for endpoint creation.
Code: BadRequest
Message: Custom domain must be specified for endpoint creation.
ERROR: az_command_data_logger: (BadRequest) Custom domain must be specified for endpoint creation.
Code: BadRequest
Message: Custom domain must be specified for endpoint creation.
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f166b572480>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.__main__: Command ran in 10.017 seconds (init: 0.199, invoke: 9.818)
INFO: cli.azure.cli.core.decorators: Suppress exception:
Traceback (most recent call last):
  File "/home/vsts/.local/lib/python3.12/site-packages/azure/cli/__main__.py", line 62, in <module>
    raise ex
  File "/home/vsts/.local/lib/python3.12/site-packages/azure/cli/__main__.py", line 55, in <module>
    sys.exit(exit_code)
SystemExit: 1

Expected behavior

The CDN endpoint should be created

Environment Summary

azure-cli 2.57.0 *

core 2.57.0 *
telemetry 1.1.0

Extensions:
azure-devops 1.0.1

Dependencies:
msal 1.26.0
azure-mgmt-resource 23.1.0b2

Additional context

This is in Azure China, which requires an older version of the CLI (2.57.0 at the latest). The SKU of the CDN is "Standard_ChinaCdn". Because I was running this in an Azure Devops pipeline, I used pip to install the correct version of the API with pip install -Iv azure-cli==2.57.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botNetworkaz network vnet/lb/nic/dns/etc...Network - CDNaz cdnService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions