azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Powershell / Rest commands for Enabling custom Domain using own certificates

Open paragbharne opened this issue 7 years ago • 17 comments

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"
}

paragbharne avatar Apr 03 '19 08:04 paragbharne

@ravindp Hey Ravindra, would your team mind taking a look at this issue?

cormacpayne avatar Apr 03 '19 15:04 cormacpayne

@ravindp if you look into the above issue it would be a great help to us.

thanks

paragbharne avatar Apr 04 '19 10:04 paragbharne

@ravindp @cormacpayne I have not heard anything from you guys, I am waiting for your reply.

paragbharne avatar Apr 12 '19 10:04 paragbharne

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.

jasongaylord avatar May 02 '19 13:05 jasongaylord

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.

fore5fire avatar Oct 17 '19 23:10 fore5fire

@lsmith130 is this in place now?

KarenHammons avatar Jan 14 '20 20:01 KarenHammons

This is still a work in progress, but I'll be prioritizing it in next week.

fore5fire avatar Jan 29 '20 23:01 fore5fire

@lsmith130 any progress with PowerShell support for enabling HTTPS using certificates from KeyVault?

jonsamwell avatar Jun 14 '20 04:06 jonsamwell

I apologize for the delay in getting this fix out, but I'll be publishing a PR which fixes this tomorrow.

fore5fire avatar Jul 24 '20 01:07 fore5fire

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cdnfdsuppgithub.

ghost avatar Aug 12 '20 15:08 ghost

@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 😄

atraviator avatar Oct 08 '20 14:10 atraviator

Is there any form to get this on powershell or AZ? @cdnfdsuppgithub is there any update?

AgueroPefai avatar Feb 03 '21 23:02 AgueroPefai

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...

timmkrause avatar Apr 28 '21 07:04 timmkrause

@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.

navba-MSFT avatar Jan 21 '22 07:01 navba-MSFT

As said. Solved via plain REST API calls. Az module + native ARM support would be greatly appreciated.

timmkrause avatar Jan 21 '22 08:01 timmkrause

@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.

navba-MSFT avatar Jan 27 '22 04:01 navba-MSFT

@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.

navba-MSFT avatar Feb 04 '22 09:02 navba-MSFT