Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
379 stars 192 forks source link

[BUG] Certificates imported in ResourceGroup from KeyVault not showing up in Azure Portal #1273

Open tcdoorn opened 3 years ago

tcdoorn commented 3 years ago

Describe the bug We're trying to import a certificate in a resourcegroup from the key vault and bind the certificate to a hostname. The method returns a OK statuscode and the import seems to be ok, however it doesn't show up in the list of ssl certificates in the azure web app (in the same resource group). We can see the certificate if we fetch a list of certificates for the current resource group in our code.

However, when we try to bind it to our hostname we get Not Found exception. We don't know what we are doing wrong.

Code Snippet

var certificateEnvelope = new CertificateInner(
                "West Europe",
                string.Empty,
                serverFarmId: webApp.AppServicePlanId,
                keyVaultId: "...",
                keyVaultSecretName: "...");

            var test = await _azure.AppServices.AppServiceCertificates.Inner.CreateOrUpdateAsync(webApp.ResourceGroupName, "...", certificateEnvelope, cancellationToken);
            await webApp.Update().DefineSslBinding().ForHostname(domain).WithExistingCertificate(test.Thumbprint).WithSniBasedSsl().Attach().ApplyAsync(cancellationToken);

Setup (please complete the following information):