Error uploading .pfx certificate to Azure Web app using ARM template from VSTS

时间:2016-08-31 12:21:24

标签: azure azure-devops azure-web-sites azure-resource-manager azure-resource-group

I'm using a Azure Resource Manager(ARM) template to create and update a resource group in a release definition in Visual Studio Team Services(VSTS). I'm using the same template to upload the .pfx certificate to the web app.

For the first deployment the certificate got uploaded perfectly, but from the next deployment the deployment fails with the error "Another certificate exists with same thumbprint ******** at location West US in the Resource Group MyResourceGroup".

I tried recreating the webapp, but to my surprise the deployment fails for the first time itself. Looks like the certificate got uploaded to the resource group.

Is there a way to overwrite the existing .pfx certificate for every deployment.

3 个答案:

答案 0 :(得分:1)

You do not have to upload certificate for all deployments. The first certificate will become available to all deployments

答案 1 :(得分:0)

Certificates are exposed at the resource group level, so deploying the same certificate again will definitely error out.

However, I don't see a reason as to why you need to upload a certificate. Does your application need to read this certificate? if yes, then there is a different way to do this. See this article: https://azure.microsoft.com/en-us/blog/using-certificates-in-azure-websites-applications/

答案 2 :(得分:0)

直到今天,我还从未遇到此错误。我能够重新部署我的应用程序,证书和所有文件,没有任何问题。我相信在我的情况下,有人以前可能通过门户使用其他名称手动添加了证书,然后在我的管道执行时,尝试使用其他名称添加证书。

证书是Microsoft.Web的子资源,在资源组下。有许多解决方案可供选择,但我将重点介绍使用Resource Explorer删除证书。 (我敢打赌,也有一个Azure CLI或Azure PowerShell命令可以做到这一点。)

在资源浏览器中,使用左侧导航窗格找到与资源组关联的证书节点。这可能类似于订阅-> {订阅名称}-> resourceGroups-> {资源组名称}->提供程序-> Microsoft.Web->证书-> {证书名称}

找到后,选择您的证书,然后可以使用右侧窗格中的“操作”(“ POST”,“ DELETE”)选项卡删除证书。然后,您应该可以重新部署。