[英]I am facing an issue while deploy storage account using arm templates
I am facing an issue while deploy storage account using arm templates:我在使用 arm 模板部署存储帐户时遇到问题:
Deployment template validation failed: 'The template resource 'sneha1' for type 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Common.Entities.TemplateGenericProperty`1[System.String]' at line '20' and column '59' has incorrect segment lengths.部署模板验证失败:“20”行和“59”列的“Microsoft.WindowsAzure.ResourceStack.Frontdoor.Common.Entities.TemplateGenericProperty`1[System.String]”类型的模板资源“sneha1”的段长度不正确. A nested resource type must have identical number of segments as its resource name.嵌套资源类型必须具有与其资源名称相同的段数。 A root resource type must have segment length one greater than its resource name.根资源类型的段长度必须比其资源名称大一。
This is my template:这是我的模板:
{
"$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"
}
}
]
}
what it says is that the resource sneha1
name is malformed, if you can share the resource name I can help you fix it, but in a nutshell name should be 1 segment shorter than type:它说的是资源sneha1
名称格式错误,如果您可以共享资源名称,我可以帮助您修复它,但简而言之,名称应该比类型短 1 段:
name: "xxx",
type: "microsoft.storage/storageAccounts"
or like so:或者像这样:
name: "xxx/diag",
type: "microsoft.storage/storageAccounts/diagnosticSettings"
This issue occurs in case your name property is greater in length than TYPE如果您的name属性的长度大于TYPE ,则会出现此问题
"apiVersion": "2016-12-01",
"name": "[concat(parameters('vaultName'), '/', parameters('policyName'))]",
"type": "Microsoft.RecoveryServices/vaults/backupPolicies"
In above example name has two level and type has 3 level.在上面的示例中,名称有两个级别,类型有 3 个级别。
Example as shown below:示例如下图:
"name":"azVault/policy1"
"type":"Microsoft.RecoveryServices/vaults/backupPolicies"
This might be your problem, remove the sneha in type and try.这可能是您的问题,删除类型中的 sneha 并尝试。
"type": "Microsoft.Storage/storageAccounts/ sneha ", "name": "[concat(parameters('storageAccounts_sneha_name'), '/copyIndex(1)' ) ]", “类型”:“Microsoft.Storage/storageAccounts/sneha”,“名称”:“[concat(参数('storageAccounts_sneha_name'),'/ copyIndex (1)')]”,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.