简体   繁体   English

使用 arm 模板部署存储帐户时遇到问题

[英]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.

相关问题 我面临的问题是使用 powershell 修改 json 文件中的值 - I am facing issue is modifying a value in json file using powershell 当我部署Azure ARM模板时,它将创建存储而不是警报 - When i deploy my Azure ARM Template it creates a storage, not an alert 我在将 json 转换为 dart 时遇到问题,下面是 json - I am facing issue when converting json to dart, below is the json 想要为 azure cosmosdb 帐户启用多读取区域,仅当我为 PROD 环境(ARM 模板)创建该帐户时 - Wanted to enable multi read region for azure cosmosdb account only if i am creating that for PROD environment (ARM Template) 格式化 JSON 时遇到问题 - facing issue while formating the JSON 为 Azure 文件共享存储帐户部署模板时面临的问题 - Facing Issues on Deploying template for Azure File Share Storage Account 使用 ARM 模板为容器部署 Web 应用程序 - Deploying Web App for containers using ARM templates 我正面临此错误执行 org.jetbrains.kotlin.gradle.internal.KaptExecution 时发生故障 - I am facing this error A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution 我在使用for循环多次调用json时遇到问题 - I am having an issue while calling json multiple time using for loop 解析有效的JSON字符串时遇到问题 - Facing issue while parsing valid JSON string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM