Azure ARM模板DependentOn FileShare

问题描述

我需要通过ARM模板存储帐户创建->文件共享->具有已安装文件共享的容器。
依赖性为:

  1. 文件共享取决于存储帐户
  2. 容器取决于文件共享

如何获取Fileshare的ReferenceId?

我有以下代码:

    {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {
            "storageAccountType": {
                "type": "string","defaultValue": "Standard_LRS","allowedValues": [
                    "Standard_LRS","Standard_GRS"
                ],"metadata": {
                    "description": "Storage account type (SKU)"
                }
            },"fileShareName": {
                "type": "string","minLength": 3,"maxLength": 63,"defaultValue": "sftp","metadata": {
                    "description": "Name of the File Share to be created. "
                }
            }
        },"variables": {
            "deploymentLocation": "[resourceGroup().location]","storageAccountName": "[concat('sftpstr',uniqueString(resourceGroup().id))]"
        },"resources": [
            {
                "type": "Microsoft.Storage/storageAccounts","name": "[variables('storageAccountName')]","apiVersion": "2019-06-01","location": "[variables('deploymentLocation')]","sku": {
                    "name": "[parameters('storageAccountType')]"
                },"kind": "StorageV2","properties": {
                    "accessTier": "Hot"
                }
            },{
                "type": "Microsoft.Storage/storageAccounts/fileServices/shares","properties": {
                    "accessTier": "Hot"
                },"name": "[concat(variables('storageAccountName'),'/default/',parameters('fileShareName'))]","dependsOn": [
                    "[resourceId('Microsoft.Storage/storageAccounts',variables('storageAccountName'))]"
                ]
            },{
                "type": "Microsoft.ContainerInstance/containerGroups","name": "sftp-container-group","apiVersion": "2018-04-01","dependsOn": [
                    "[resourceId('Microsoft.Storage/storageAccounts/fileServices/shares',????? )]" //how to get reference to specific Fileshare??? I've tried >   [concat(variables('storageAccountName'),parameters('fileShareName'))] but it didn't work
                ],"properties": {
                    .......
                }
            }
        ] 
    }

而且我不知道如何设置对Fileshare的依赖性:

"dependsOn": [
    "[resourceId('Microsoft.Storage/storageAccounts/fileServices/shares',????? )]" //how to get reference to specific Fileshare??? 
],

我尝试过[concat(variables('storageAccountName'),parameters('fileShareName'))],但没有用。

有什么主意吗?

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)