question

MattHoneycutt-3147 avatar image
0 Votes"
MattHoneycutt-3147 asked ryanchill commented

Creating App Service Managed Certificates via API

Now that App Service Managed Certificates are Generally Available, is there a way to create one programmatically with the API? I've seen the workaround that suggests calling Powershell to execute the command through the CLI, but that's not a great option for our particular use case.

azure-webapps-ssl-certificates
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
1 Vote"
ryanchill answered ryanchill commented

Hi @MattHoneycutt-3147,

Yes, you should be able to. Have a look at https://docs.microsoft.com/en-us/rest/api/appservice/certificates/create-or-update. All that should be required is canonical and host names in the request body.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}?api-version=2019-08-01

{
    "location": "East US",
    "properties": {
        "canonicalName": "My Managed Cert Name",
        "hostNames": [
            "ServerCert"
        ]
    }
}
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Ah, ok. Once I have created the cert, how would I go about applying it to my app service?

0 Votes 0 ·

properties.hostNames and properties.serverFarmId are the properties to set in order to apply the cert to a particular app service.

0 Votes 0 ·