Powershell / Rest commands for Enabling custom Domain using own certificates
I want to use my own SSL certificates for the enabling CDN custom domain store in the Azure Keyvault.
I used the below PowerShell commands to do that but that enable the default CDN managed certificates. "Enable-AzureRmCdnCustomDomain"
I am trying it to achieve through the rest followed below docs, https://docs.microsoft.com/en-us/rest/api/cdn/customdomains/enablecustomhttps#usermanagedhttpsparameters
Below are my request and body :
https://management.azure.com/subscriptions/{{subscruptionId}}/resourceGroups/{{rg}}/providers/Microsoft.Cdn/profiles/{{profile}}/endpoints/{{endpoint}}/customDomains/{{customdomain}}/enableCustomHttps?api-version=2016-10-02
{
"certificateSource": "AzureKeyVault",
"protocolType": "ServerNameIndication",
"certificateSourceParameters": {
"OData.type":"#Microsoft.Azure.Cdn.Models.KeyVaultCertificateSourceParameters",
"subscriptionId":"#######################",
"resourceGroupName":"rgname",
"vaultName":"vaultname",
"secretName" : "secretname",
"secretVersion" :"####66#################",
"updateRule": "NoAction",
"deleteRule": "NoAction"
}
}
After the above request and body, I am able to enable the Custome https but I would configure the Managed CDN Certs.
{
"provisioningState": "Succeeded",
"resourceState": "Active",
"hostName": "test.domain.com",
"validationData": null,
"customHttpsProvisioningState": "Enabling"
}
@ravindp Hey Ravindra, would your team mind taking a look at this issue?
@ravindp if you look into the above issue it would be a great help to us.
thanks
@ravindp @cormacpayne I have not heard anything from you guys, I am waiting for your reply.
We've used similar code in one of our release pipelines and when hitting the Management REST API, it seems as though the custom domain is stuck in the 'Enabling' state.
I'm currently working on implementing PowerShell support for enabling HTTPS using certificates from KeyVault, and I should have it ready by the end of the month.
@lsmith130 is this in place now?
This is still a work in progress, but I'll be prioritizing it in next week.
@lsmith130 any progress with PowerShell support for enabling HTTPS using certificates from KeyVault?
I apologize for the delay in getting this fix out, but I'll be publishing a PR which fixes this tomorrow.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cdnfdsuppgithub.
@lsmith130 Have you been able to make any further progress with this feature? My team would really appreciate being able to set CDN certificates via key vault in PowerShell!
Thanks for your time and effort 😄
Is there any form to get this on powershell or AZ? @cdnfdsuppgithub is there any update?
Over 2 years and no progress on this (same goes for native ARM support), Azure CLI does support it...
Unfortunately Azure CLI and PowerShell Az modules cannot be used side-by-side in an ARM template as well (Microsoft.Resources/deploymentScripts) where it could potentially be combined...
So we really have to get bare bones and use the REST API (where I actually don't know if pulling "Latest" certificate/secret version from Key Vault is possible, as it is completely undocumented).
This yak shaving really is a pain...
@paragbharne Apologies for the delayed response. I see that this issue thread is open for quite sometime now and there has been no progress. So wanted to check if you are still looking for assistance on this query? Please let us know.
Also I wanted to check if you if you are able to achieve the ask using this REST API. I will check and update this thread about the Powershell support to achieve the same requirement.
As said. Solved via plain REST API calls. Az module + native ARM support would be greatly appreciated.
@timmkrause @paragbharne CDN PS cmdlet doesn’t support user managed certificate currently. The CDN engineering group is aware of this and they are working on this ask.
So until the fix is released, as a workaround you can use CLI az cdn custom-domain | Microsoft Docs . Hope this helps.
Please let us know if you have any further queries on this.
@paragbharne Hope you had a chance to look at the above reply. Please feel free to reopen this thread if you have any pending questions. We would be happy to address those.