尝试使用我在ARM模板的属性部分中迭代的多个主机名从Azure密钥保管库应用证书,但它失败并显示消息“HTTP请求主体不能为空”
我的ARM模板如下所示:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServiceName": {
"type": "string",
"metadata": {
"description": "Name of app service to apply SSL to."
}
},
"certificateName": {
"type": "string",
"metadata": {
"description": "User friendly certificate resource name"
}
},
"appServicePlan": {
"type": "string",
"metadata": {
"description": "App Service Plan Name"
}
},
"keyVaultId": {
"type": "string",
"metadata": {
"description": "Existing Key Vault resource Id with an access policy to allow Microsoft.Web RP to read Key Vault secrets (Checkout README.md for more information)"
}
},
"hostname": {
"type": "array",
"metadata": {
"description": "Custom hostname for creating SSL binding. This hostname should already be assigned to the Web App"
}
}
},
"resources": [
{
"apiVersion": "2016-03-01",
"type": "Microsoft.Web/sites",
"name": "[parameters('appServiceName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/certificates', parameters('certificateName'))]"
],
"properties": {
"copy": [
{
"name": "hostnames",
"count": "[length(parameters('hostname'))]",
"input": {
"name": "[copyIndex('hostnames')]",
"properties": {
"hostNameSslStates": [
{
"name": "[parameters('hostname')[copyIndex('hostnames')]]",
"sslState": "SniEnabled",
"thumbprint": "[reference(resourceId('Microsoft.Web/certificates', parameters('certificateName'))).Thumbprint]",
"toUpdate": true
}
]
}
}
}
]
}
},
{
"type": "Microsoft.Web/certificates",
"name": "[parameters('certificateName')]",
"apiVersion": "2016-03-01",
"location": "[resourceGroup().location]",
"properties": {
"keyVaultId": "[parameters('keyVaultId')]",
"keyVaultSecretName": "[parameters('certificateName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms',parameters('appServicePlan'))]"
}
}
]
}
我得到的错误:
New-AzureRmResourceGroupDeployment:资源Microsoft.Web / sites'developapp'失败,消息为'{ “代码”:“BadRequest”, “消息”:“HTTP请求正文不能为空。”, “目标”:null, “细节”: [ { “消息”:“HTTP请求正文不能为空”。 }, { “代码”:“BadRequest” }, { “ErrorEntity”:{ “ExtendedCode”:“51016”, “MessageTemplate”:“HTTP请求正文不能为空。”, “参数”:[], “代码”:“BadRequest”, “消息”:“HTTP请求正文不能为空”。 } } ] “Innererror”:null }” 在行:1个字符:1 + New-AzureRmResourceGroupDeployment -Name test -ResourceGroupName deve ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:NotSpecified:(:) [New-AzureRmResourceGroupDeployment],Exception + FullyQualifiedErrorId:Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
VERBOSE:13:52:43 - 资源Microsoft.Web /证书'testCert'配置状态成功 New-AzureRmResourceGroupDeployment:13:52:43 - 跳过模板输出评估:至少一个资源部署 操作失败。请列出部署操作以获取详细信息有关usag的信息,请参阅https://aka.ms/arm-debug 细节。 在行:1个字符:1 + New-AzureRmResourceGroupDeployment -Name test -ResourceGroupName deve ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:NotSpecified:(:) [New-AzureRmResourceGroupDeployment],Exception + FullyQualifiedErrorId:Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment:13:52:43 - 跳过模板输出评估:至少一个资源部署 操作失败。请列出部署操作以获取详细信息有关usag的信息,请参阅https://aka.ms/arm-debug 细节。 在行:1个字符:1 + New-AzureRmResourceGroupDeployment -Name test -ResourceGroupName deve ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:NotSpecified:(:) [New-AzureRmResourceGroupDeployment],Exception + FullyQualifiedErrorId:Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
你们中的任何人都有可能导致这种情况的建议吗?提前谢谢!
答案 0 :(得分:0)
试试这个而不是你的副本:
"copy": [
{
"name": "hostNameSslStates",
"count": "[length(parameters('hostname'))]",
"input": {
"name": "[parameters('hostname')[copyIndex('hostNameSslStates')]]",
"sslState": "SniEnabled",
"thumbprint": "[reference(resourceId('Microsoft.Web/certificates', parameters('certificateName'))).Thumbprint]",
"toUpdate": true
}
}
]