使用手臂模板部署存储帐户时,我遇到了一个问题:
部署模板验证失败:'模板资源'sneha1' 用于类型 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Common.Entities.TemplateGenericProperty`1 [System.String]' 第'20'行和第'59'列的段长度不正确。巢状 资源类型必须具有与其资源相同的段数 名称。根资源类型的段长度必须大于1 它的资源名称。
这是我的模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccounts_sneha_name": {
"defaultValue": "sneha,
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts/sneha",
"apiVersion": "2019-04-01",
"name": "[concat(parameters('storageAccounts_sneha_name'), copyIndex(1) ) ]",
"location": "centralus",
"copy":{
"Name":"rama",
"count": 5
},
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "StorageV2",
"properties": {
"networkAcls": {
"bypass": "AzureServices",
"virtualNetworkRules": [],
"ipRules": [],
"defaultAction": "Allow"
},
"supportsHttpsTrafficOnly": true,
"encryption": {
"services": {
"file": {
"enabled": true
},
"blob": {
"enabled": true
}
},
"keySource": "Microsoft.Storage"
},
"accessTier": "Hot"
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2019-04-01",
"name": "[concat(parameters('storageAccounts_sneha_name'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_sneha_name'))]"
],
"properties": {
"cors": {
"corsRules": []
},
"deleteRetentionPolicy": {
"enabled": false
}
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2019-04-01",
"name": "[concat(parameters('storageAccounts_sneha_name'), '/default/container1')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccounts_sneha_name'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_sneha_name'))]"
],
"properties": {
"publicAccess": "Blob"
}
}
]
}
答案 0 :(得分:1)
它表示资源sneha1
的名称格式错误,如果您可以共享资源名称,我可以帮助您解决它,但概括地说,名称应比类型短1个段:
name: "xxx",
type: "microsoft.storage/storageAccounts"
或者像这样:
name: "xxx/diag",
type: "microsoft.storage/storageAccounts/diagnosticSettings"
答案 1 :(得分:1)
如果您的 name 属性的长度大于 TYPE
,则会发生此问题"apiVersion": "2016-12-01",
"name": "[concat(parameters('vaultName'), '/', parameters('policyName'))]",
"type": "Microsoft.RecoveryServices/vaults/backupPolicies"
在上面的示例中,名称具有两个级别,类型具有3个级别。
示例如下所示:
"name":"azVault/policy1"
"type":"Microsoft.RecoveryServices/vaults/backupPolicies"
答案 2 :(得分:0)
这可能是您的问题,请删除键入的提示并尝试。
“类型”:“ Microsoft.Storage/storageAccounts/ sneha ”, “ name”:“ [concat(parameters('storageAccounts_sneha_name'),'/ copyIndex(1)')]”,