Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 尝试使用专用终结点和专用链接运行ARM模板进行存储帐户设置时出错_Azure_Azure Storage Blobs_Azure Resource Manager_Azure Storage Account_Infrastructure As Code - Fatal编程技术网

Azure 尝试使用专用终结点和专用链接运行ARM模板进行存储帐户设置时出错

Azure 尝试使用专用终结点和专用链接运行ARM模板进行存储帐户设置时出错,azure,azure-storage-blobs,azure-resource-manager,azure-storage-account,infrastructure-as-code,Azure,Azure Storage Blobs,Azure Resource Manager,Azure Storage Account,Infrastructure As Code,我正在尝试使用ARM模板部署V2存储帐户以及专用端点和专用链接。我的订阅中已经存在一个资源组、VNET和子网,我想利用它们为新的存储帐户提供一个专用端点和专用链接 当我从powershell运行命令部署ARM模板时,它会抛出错误,尽管我可以看到正在创建私有端点和存储帐户。我没有看到的是私有链接 New-AzResourceGroupDeployment : 11:02:18 PM - The deployment 'Storacc_PvtEndpoint' failed with error(

我正在尝试使用ARM模板部署V2存储帐户以及专用端点和专用链接。我的订阅中已经存在一个资源组、VNET和子网,我想利用它们为新的存储帐户提供一个专用端点和专用链接

当我从powershell运行命令部署ARM模板时,它会抛出错误,尽管我可以看到正在创建私有端点和存储帐户。我没有看到的是私有链接

New-AzResourceGroupDeployment : 11:02:18 PM - The deployment 'Storacc_PvtEndpoint' 
failed with error(s). Showing 1 out of 1 error(s).
Status Message: Cannot parse the request. (Code: InvalidRequestFormat)
 - Error converting value "blob" to type 
'System.Collections.Generic.ICollection`1[System.String]'. Path 
'properties.privateLinkServiceConnections[0].properties.groupIds', line 1, position 
336. (Code:InvalidJson)
CorrelationId: 9606ab6b-35d6-49c0-a811-fa5154ff83e6
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName dops-pipeline -Templ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exc 
   eption
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Imple 
   mentation.NewAzureResourceGroupDeploymentCmdlet
 


DeploymentName          : Storacc_PvtEndpoint
ResourceGroupName       : dops-pipeline
ProvisioningState       : Failed
Timestamp               : 5/26/2021 2:02:13 AM
Mode                    : Incremental
TemplateLink            : 
Parameters              : 
                          Name                                     Type              
                                   Value     
                          =======================================  
                          =========================  ==========
                          storageAccountType                       String            
                                   Standard_LRS
                          location                                 String            
                                   canadacentral
                          containerPrefix                          String            
                                   canadacentral
                          vnetName                                 String            
                                   pvt-endpoint-vnet
                          subnetName                               String            
                                   blob-pvt-endpoint-sub
                          resourceGroupName                        String            
                                   dops-pipeline
                          blobStorageAccountPrivateEndpointName    String            
                                   endpointsht5gcoc5cztq
                          
Outputs                 : 
DeploymentDebugLogLevel : 
请在下面找到我的手臂模板

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountType": {
            "type": "string",
            "defaultValue": "Standard_LRS",
            "allowedValues": [
                "Standard_LRS",
                "Standard_GRS",
                "Standard_ZRS",
                "Premium_LRS"
            ],
            "metadata": {
                "description": "Storage Account type"
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Storage Account Location"
            }
        },
        "containerPrefix" : {
            "type"          : "string",
            "defaultValue"  : "[resourceGroup().location]"
        },
        "vnetName" : {
            "type"           : "string",
            "defaultValue"   : "pvt-endpoint-vnet"
        },
        "subnetName"         : {
            "type"           : "string",
            "defaultValue"   : "blob-pvt-endpoint-sub"
        },
        "resourceGroupName"  : {
            "type"           : "string",
            "defaultValue"   : "dops-pipeline"
        },
        "blobStorageAccountPrivateEndpointName" : {
            "type"            : "string",
            "defaultValue"    : "[toLower(concat('endpoint',uniqueString(resourceGroup().id)))]"
        }
},
    "variables": {
        "blobstorageAccountName"                      : "[tolower(concat('stor', uniquestring(subscription().id,resourceGroup().id)))]",
        "blobStorageAccountId"                        : "[resourceId('Microsoft.Storage/storageAccounts', variables('blobStorageAccountName'))]",
        "blobPublicDNSZoneForwarder"                  : "[concat('.blob.', environment().suffixes.storage)]",
        "blobPrivateDNSZoneName"                      : "[concat('privatelink', variables('blobPublicDNSZoneForwarder'))]",
        "blobPrivateDnsZoneId"                        : "[resourceId('Microsoft.Network/privateDnsZones', variables('blobPrivateDnsZoneName'))]",
        "blobPrivateDnsZoneGroup"                     : "[concat(parameters('blobStorageAccountPrivateEndpointName'),'/', variables('blobStorageAccountPrivateEndpointGroupName'), 'PrivateDnsZoneGroup')]",
        "blobStorageAccountPrivateEndpointGroupName"  : "blob",
        "vnetId"                                      : "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('resourceGroupName'),'/providers/','Microsoft.Network/virtualNetworks/',parameters('vnetName'))]",
        "subnetId"                                    : "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('resourceGroupName'),'/providers/','Microsoft.Network/virtualNetworks/',parameters('vnetName'),'/subnets/',parameters('subnetName'))]"
    },
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2021-01-01",
            "name": "[variables('blobstorageAccountName')]",
            "location": "[parameters('location')]",
            "sku": {
                "name": "[parameters('storageAccountType')]"
            },
            "kind": "StorageV2",
            "properties": {
                "minimumTlsVersion"     : "TLS1_2",
                "allowBlobPublicAccess" : false,
                "networkAcls": {
                    "bypass" : "AzureServices",
                    "defaultAction" : "Deny",
                    "virtualNetworkRules" : [
                        {
                            "id"     : "[variables('subnetId')]",
                            "action" : "Allow"
                        }
                    ]
                }
            }
        },
        {
            "type"      : "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
            "apiVersion": "2018-09-01",
            "name"      : "[concat(variables('blobPrivateDNSZoneName'), '/link_to_', toLower(parameters('vnetName')))]",
            "location"  : "global",
            "dependsOn" : [
                "[variables('blobPrivateDnsZoneId')]"
            ],
            "properties" : {
                "registrationEnabled" : false,
                "virtualNetwork"      : {
                    "id"              : "[variables('vnetId')]"
                }
            }
        },
        {
            "type"       : "Microsoft.Network/privateEndpoints",
            "apiVersion" : "2020-04-01",
            "name"       : "[parameters('blobStorageAccountPrivateEndpointName')]",
            "location"   : "[resourceGroup().location]",
            "dependsOn"  : [
                "[variables('blobStorageAccountId')]"
            ],
            "properties" : {
                "privateLinkServiceConnections" : [
                    {
                      "name" : "parameters('blobStorageAccountPrivateEndpointName')",
                      "properties" : { 
                            "privateLinkServiceId"  : "[variables('blobStorageAccountId')]",
                            "groupIds"              : "[variables('blobStorageAccountPrivateEndpointGroupName')]"
                        }
                    }
                ],
                "subnet" :{
                    "id" : "[variables('subnetId')]"
                },
                "customDnsConfigs" : [
                    {
                        "fqdn"     : "[concat(variables('blobStorageAccountName'),variables('blobPublicDNSZoneForwarder'))]"
                    }
                ]
            }
        },
        {
            "type"       : "Microsoft.Network/privateDnsZones",
            "apiVersion" : "2018-09-01",
            "name"       : "[variables('blobPrivateDNSZoneName')]",
            "location"   : "global",
            "properties" : {
                "maxNumberOfRecordSets"                            : 25000,
                "maxNumberOfVirtualNetworkLinks"                   : 1000,
                "maxNumberOfVirtualNetworkLinksWithRegistration"   : 100
            }
        },
        {
            "type"       : "Microsoft.Network/privateEndpoints/privateDnsZoneGroups",
            "apiVersion" : "2020-03-01",
            "name"       : "[variables('blobPrivateDnsZoneGroup')]",
            "location"   : "[resourceGroup().location]",
            "dependsOn"  : [
                "[variables('blobPrivateDnsZoneId')]",
                "[parameters('blobStorageAccountPrivateEndpointName')]"
            ],
            "properties"  : {
                "privateDnsZoneConfigs" :[
                    {
                        "name"       : "dnsConfig",
                        "properties" : {
                            "privateDnsZoneId" : "[variables('blobPrivateDnsZoneId')]"
                        }
                    }
                ]
            }
        },
        {
            "type": "Microsoft.Storage/storageAccounts/blobServices",
            "apiVersion": "2021-01-01",
            "name"      :"[tolower(concat(variables('blobstorageaccountname'), '/default'))]",
            "dependsOn": [
              "[resourceId('Microsoft.Storage/storageAccounts', variables('blobstorageAccountName'))]"
            ],
            "properties": {
                "isVersioningEnabled"   : true,
                "deleteRetentionPolicy" : {
                    "enabled" :  true,
                    "days"    :  30
                },
                "changeFeed"  : {
                    "enabled"        : true
                },
                "containerDeleteRetentionPolicy" :{
                    "enabled" : true,
                    "days"    : 30
                }
            }
        },
        {
            "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
            "apiVersion": "2021-01-01",
            "name": "[concat(variables('blobstorageAccountName'), '/default/', parameters('containerPrefix'), copyIndex())]",
            "copy": {
                "name": "containercopy",
                "count": 2
            },
            "dependsOn": [
              "[resourceId('Microsoft.Storage/storageAccounts', variables('blobstorageAccountName'))]"
            ] 
        }
    ],
    "outputs": {
        "storageAccountName": {
            "type": "string",
            "value": "[variables('blobstorageAccountName')]"
        }
    }
}

这个问题通过@Thomas的评论解决了,只需添加它们作为结束问题的答案

您需要从
dependsOn
中删除
“[variables('vnetId')]”
,如果模板中未定义资源,则不应在
dependsOn
中使用该资源,并且属性
groupid
是一个数组,因此应该是:
“groupid”:[“[variables('blobstorageaccountprivatedpointgroupname')]”


Reference-

您需要从
dependsOn
中删除“[variables('vnetId')]”。您只能为模板中声明的资源设置依赖。请从porperty
dependsOn
中删除
[variables('vnetId')]
。否则,您需要在模板中定义资源。@Thomas删除“[variables('vnetId)]”后,我会出现以下错误,但我可以看到随pvt端点vnet一起创建的存储帐户。但是我没有看到私有链接。哪个错误?您需要检查所有的
dependson
。如果模板中未定义资源,则不应在
dependson
@Thomas中使用该资源。如果您看到我的主线程,我已删除依赖并将新代码粘贴到顶部。我现在得到这个错误:将值“blob”转换为类型时出错