Skip to content

Enable-AzCdnCustomDomainCustomHttps - Bad Request (Property 'CustomHttpsParameters.CertificateSourceParameters.CertificateType' is required but it was not set) #18700

Closed

Description

Description

I'm trying to enable HTTPS in my CDN custom domain. I want it to have a CDN-managed certificate.

I get the Cdn Custom Domain using Get-AzCdnCustomDomain and pipe the result to Enable-AzCdnCustomDomainCustomHttps.

I pass a hash table to Enable-AzCdnCustomDomainCustomHttps' CustomDomainHttpsParameter.

The hash table is defined as:

$customDomainHttpsParameter = @{
  CertificateSource = "Cdn"
  ProtocolType = "ServerNameIndication"
  MinimumTlsVersion = "TLS12" 
}

But the response is a BadRequest with the error message:

"Property 'CustomHttpsParameters.CertificateSourceParameters.CertificateType' is required but it was not set"

I've also tried:

$customDomainHttpsParameter = @{
  CertificateSource = "Cdn"
  ProtocolType = "ServerNameIndication"
  MinimumTlsVersion = "TLS12" 
  CertificateSourceParameter = @{
    CertificateType = "Shared"
  }  
}

But the result is the same. When running with -Debug flag I see the payload being POSTed is:

Body:
{
  "certificateSource": "Cdn",
  "protocolType": "ServerNameIndication",
  "minimumTlsVersion": "TLS12"
}

So the CertificateSourceParameter , if needed at all, is being ignored by the parser.
This behaviour is probably driven by this part of the code.

It looks like a mismatch between the REST API and what the cmdlet serializes and sends. Or could I be creating my hash table incorrectly? The documentation is incomplete.

How can I enable HTTPS in my CDN custom domain using this PowerShell Module?

Issue script & Debug output

$customDomainHttpsParameter = @{
  CertificateSource = "Cdn"
  ProtocolType = "ServerNameIndication"
  MinimumTlsVersion = "TLS12" 
  CertificateSourceParameter = @{
    CertificateType = "Shared"
  }  
}

Get-AzCdnCustomDomain -ResourceGroupName $ResourceGroup -ProfileName $ProfileName -EndpointName $EndpointName -Name $CustomDomainName | Enable-AzCdnCustomDomainCustomHttps -CustomDomainHttpsParameter $customDomainHttpsParameter -Debug

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.4
PSEdition                      Core
GitCommitId                    6.2.4
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.8.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     2.1.0      Az.Cdn                              {Clear-AzCdnEndpointContent, Clear-AzFrontDoorCdnEndpointContent, Disable-AzCdnCustomDomainCustomHttps, Enable-AzCdnCustomDomainCustomHttps…}

Error output

Message        : [BadRequest] : Property 'CustomHttpsParameters.CertificateSourceParameters.CertificateType' is required but it was not set
StackTrace     :
Exception      : System.Exception
InvocationInfo : {Enable-AzCdnCustomDomainCustomHttps_EnableViaIdentity}
Line           : Get-AzCdnCustomDomain -ResourceGroupName $ResourceGroup -ProfileName $ProfileName -EndpointName $EndpointName -Name $CustomDomainName | Enable-AzCdnCustomDomainCustomHttps
                 -CustomDomainHttpsParameter $customDomainHttpsParameter -Debug

Position       : At C:\...\SetCdn.ps1:47 char:1
                 + Get-AzCdnCustomDomain -ResourceGroupName $ResourceGroup -ProfileName  ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

CXP Attention[Deprecated] The Azure CXP Support Team is responsible for this issue.Network - CDNbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions