Command Name
az cdn custom-domain enable-https
Errors:
InvalidResource - The resource format is invalid.
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
#!/bin/bash
set -e
CDN_ENDPOINT_NAME=$1
CDN_PROFILE_NAME=$2
RESOURCE_GROUP_NAME=$3
CDN_CUSTOM_DOMAIN_HOSTNAME=$4
# Check the mapping
CUSTOM_DOMAIN_VALIDATED=$(az cdn endpoint validate-custom-domain --host-name $CDN_CUSTOM_DOMAIN_HOSTNAME -n $CDN_ENDPOINT_NAME --profile-name $CDN_PROFILE_NAME -g $RESOURCE_GROUP_NAME --query customDomainValidated -o tsv)
# Create the custom domain on the endpoint
if [ $CUSTOM_DOMAIN_VALIDATED ]; then
az cdn custom-domain create \
--endpoint-name $CDN_ENDPOINT_NAME \
--hostname $CDN_CUSTOM_DOMAIN_HOSTNAME \
-n CDN \
--profile-name $CDN_PROFILE_NAME \
-g $RESOURCE_GROUP_NAME
fi
# Enable custom domain HTTPS
az cdn custom-domain enable-https \
--endpoint-name $CDN_ENDPOINT_NAME \
-n CDN \
--profile-name $CDN_PROFILE_NAME \
-g $RESOURCE_GROUP_NAME
Azure would begin enabling HTTPS for the custom domain in Azure CDN endpoint.
Similar works from PowerShell core command
# Enable custom domain HTTPS
Enable-AzCdnCustomDomainHttps -EndpointName $EndpointName -ProfileName $ProfileName -ResourceGroupName $rgName -CustomDomainName CDN
Linux-4.4.0-18362-Microsoft-x86_64-with-debian-buster-sid
Python 3.6.5
Shell: bash
azure-cli 2.0.81 *
Creation of custom domain for Azure CDN endpoint works fine. Only the last part fails.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc
This issue apparently still exists with version 2.1.0.
I'm also seeing this issue with a raw az rest call to https://management.azure.com/subscriptions/[redacted]/resourceGroups/[redacted]/providers/Microsoft.Cdn/profiles/[redacted]/endpoints/[redacted]/customdomains/[redacted]/enableCustomHttps?api-version=2019-04-15
bash-5.0# az cdn custom-domain enable-https --resource-group tfdev --profile-name tfctfcdn --name ctfzaitaio --endpoint-name ctfzaitaio
InvalidResource - The resource format is invalid.
bash-5.0# az -v
azure-cli 2.1.0
command-modules-nspkg 2.0.3
core 2.1.0
nspkg 3.0.4
telemetry 1.0.4
Python location '/usr/local/bin/python'
Extensions directory '/root/.azure/cliextensions'
Python (Linux) 3.6.9 (default, Nov 15 2019, 03:58:01)
[GCC 8.3.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Please let us know how we are doing: https://aka.ms/clihats
Seeing this with the official docker image: mcr.microsoft.com/azure-cli:latest
Same issue here
azure-cli 2.1.0
command-modules-nspkg 2.0.3
core 2.1.0
nspkg 3.0.4
telemetry 1.0.4
Python location '/opt/az/bin/python3'
Extensions directory '/home/juliano/.azure/cliextensions'
Python (Linux) 3.6.5 (default, Feb 14 2020, 05:23:22)
[GCC 9.2.1 20191008]
Same issue also within CloudShell
{
"azure-cli": "2.1.0",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.1.0",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {}
}
Python 3.5.2 (default, Oct 8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
This looks like a duplicate of #12152. PR #12648 will fix this when it is merged.
I had the same problem. Seems like the api-version used isn't compatible. The .Net SDK uses api version 2017-04-02 and when using that as a custom rest call I got it to work. The rest page for this call also mentions 2017-04-02 at the URI paramaters as the working version. But all the other values on there refer to 2019-04-15 which gives this same error.
https://docs.microsoft.com/en-us/rest/api/cdn/customdomains/enablecustomhttps#uri-parameters
Long story short. The CLI is using the wrong api version or the api is broken. Take your pick. :-)
My CLI version.
"azure-cli": "2.5.0",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.5.0",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {
"azure-cli-iot-ext": "1.1.0",
"azure-devops": "1.25.8"
}
The CLI version on Azure belonging to the screenshot below:
{
"azure-cli": "2.4.0",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.4.0",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {}
}

Fixed in #12648
Most helpful comment
This issue apparently still exists with version 2.1.0.