gpt4 book ai didi

Azure 操作返回无效状态 'Conflict'

转载 作者:行者123 更新时间:2023-12-03 07:08:06 28 4
gpt4 key购买 nike

我在运行 powershell 时遇到以下错误

$thumbprint=$(az webapp config ssl upload --certificate-file $Path --certificate-password $(pwd) --name $env:APP_NAME --resource-group $env:RG_NAME --query thumbprint --output tsv)



{"Code":"Conflict","Message":"Another certificate exists with same thumbprint xxxxxxxxxxxxxxxxxxxxxxxxxxx at location xxxxxx in the Resource Group xxxxxx.","Target":null,"Details":[{"Message":"Another certificate exists with same thumbprint xxxxxxxxxxxxxxxxxxxxxxxxxxx at location xxxxxx in the Resource Group xxxxxx."},{"Code":"Conflict"},{"ErrorEntity":{"ExtendedCode":"53008","MessageTemplate":"Another certificate exists with same thumbprint {0} at location {1} in the Resource Group {2}.","Parameters":["xxxxxxxxxxxxxxxxxxxxxxxxxxx","xxxxxx","xxxxxx"],"Code":"Conflict","Message":"Another certificate exists with same thumbprint xxxxxxxxxxxxxxxxxxxxxxxxxxx at location xxxxxx in the Resource Group xxxxxx."}}],"Innererror":null}

最佳答案

当您尝试上传具有不同证书名称的现有证书时,您会收到此错误。最常见的情况是,将 ARM 模板作为 CI/CD 工作流程的一部分运行(在通过门户进行初始设置之后)。将相同的证书上传到两个不同的 AppServicePlan 是另一种常见场景(位于同一个 WebSpace 中)。
您可以通过更改 ARM 模板来解决此问题,以便证书资源名称与资源浏览器中的名称相匹配。或者,您可以删除旧证书并运行 ARM 模板。
要获取证书资源名称,您可以尝试下面列出的 PowerShell 脚本。

$resourceGroupName = "SixShotRG"
$thumbprint = "78311D191030008F5D7EEDC0FCC295AFEED5DFD7"

$certificates = Get-AzResource `
-ResourceGroupName $resourceGroupName `

-ResourceType Microsoft.Web/certificates
Write-Host ("Looking for thumbprint " + $thumbprint + "..." )
Write-Host ("`tFound " + $certificates.Count `
+ " certificates in ResourceGroup : " `
+ $resourceGroupName `
+ $resourceGroup.Name)
foreach ($certificate **in** $certificates) {
$cert = Get-AzResource `
-ResourceGroupName $resourceGroupName `
-ResourceType Microsoft.Web/certificates `
-ResourceName $certificate.Name
if ($thumbprint -eq $cert.properties.thumbprint) {
Write-Host ("`tFound our cert in " `
+ $cert.properties.webSpace `
+ ' webspace')
+ Write-Host ("`tCert name is " `
+ $cert.Name)
Exit
}
}

关于Azure 操作返回无效状态 'Conflict',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71044304/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com