如何在ARM模板中引用在Azure门户中创建的现有存储帐户

`

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {
        "Inputstorageaccount": {
            "defaultvalue": "inputstgdev","type": "String"
        },"GitrepoBranch": {
           "type": "string","defaultvalue": "master","metadata": {
                "description": "Name of the branch to use when deploying (Default = master)."
            }
        },"GitrepoURL": {
           "type": "string","defaultvalue": "https://github.com/FBoucher/AzUnzipEverything.git","metadata": {
                "description": "URL to repo (Default = master)."
            }
        },"InputcontainerName": {
          "type": "string","defaultvalue": "inputcontainer","metadata": {
            "description": "Specifies the name of the blob container."
          }
        },"Outputstorageaccount": {
            "defaultvalue": "outputstgdev","OutputcontainerName": {
          "type": "string","defaultvalue": "outputcontainer","metadata": {
            "description": "Specifies the name of the blob container."
          }
        }
    },"variables": {},"resources": [
        {
            "type": "microsoft.Storage/storageaccounts/blobServices/containers","apiVersion": "2019-06-01","name": "[concat(parameters('Inputstorageaccount'),'/default/',parameters('InputcontainerName'))]","properties": {
                "publicaccess": "None"
            }
        },{
            "type": "microsoft.Storage/storageaccounts/blobServices/containers","name": "[concat(parameters('Outputstorageaccount'),parameters('OutputcontainerName'))]",{
            "name": "serviceplan","type": "microsoft.Web/serverfarms","apiVersion": "2018-02-01","location": "[resourceGroup().location]","sku": {
                "name": "F1","capacity": 1
            },"tags": {
                "displayName": "serviceplan"
            },"properties": {
                "name": "serviceplan"
            }
        },{
            "name": "functionapp","type": "microsoft.Web/sites","apiVersion": "2018-11-01","kind": "functionapp","dependsOn": [
                "[resourceId('microsoft.Web/serverfarms','serviceplan')]","[resourceId('microsoft.Storage/storageaccounts',parameters('Inputstorageaccount'))]"
            ],"properties": {
                "serverFarmId": "[resourceId('microsoft.Web/serverfarms',"siteConfig": {
                    "appSettings": [
                        {
                            "name": "AzureWebJobsDashboard","value": "[concat('DefaultEndpointsProtocol=https;accountName=',parameters('Inputstorageaccount'),';accountKey=',listKeys(parameters('InputcontainerName'),'2015-05-01-preview').key1)]"
                        },{
                            "name": "AzureWebJobsStorage",{
                            "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",{
                            "name": "WEBSITE_CONTENTSHARE","value": "[toLower('functionapp')]"
                        },{
                            "name": "FUNCTIONS_EXTENSION_VERSION","value": "~2"
                        },{
                            "name": "APPINSIGHTS_INSTRUMENTATIONKEY","value": "[reference(resourceId('microsoft.insights/components/','applicationInsightsname'),'2015-05-01').InstrumentationKey]"
                        },{
                            "name": "FUNCTIONS_WORKER_RUNTIME","value": "dotnet"
                        }
                    ]
                }
            },"resources":[
                {
                    "apiVersion": "2015-08-01","name": "web","type": "sourcecontrols","dependsOn": [
                      "[resourceId('microsoft.Web/sites/',parameters('Inputstorageaccount'))]"
                    ],"properties": {
                        "RepoUrl": "[parameters('GitrepoURL')]","branch": "[parameters('GitrepoBranch')]","publishRunbook": true,"IsManualIntegration": true
                    }
                }
            ]

        }
    ]
}

我在Azure门户中创建了一个名为 STGaccount 的存储帐户,并希望使用ARM模板在此中创建一个名为 inputcontainer 的容器STGaccount 。每次尝试这样做时,我都会收到一条错误消息,指出我正在尝试使用ARM模板创建的存储帐户 STGaccount 已存在于资源组中...。所以我想我正在写我的ARM模板仍然可以创建一个新的存储帐户,其名称类似于我在资源组中已经拥有的名称。我实际上想要做的是引用我的AR​​M模板中已经存在的存储帐户,这样我就不必创建一个新的帐户。 预先感谢,我期待着您的答复
iCMS 回答:如何在ARM模板中引用在Azure门户中创建的现有存储帐户

尝试使用此ARM模板,这将帮助您在现有存储帐户中创建一个容器。

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {
        "storageAccountName": {
            "defaultValue": "STGaccount","type": "String"
        },"containerName": {
          "type": "string","defaultValue": "inputcontainer","metadata": {
            "description": "Specifies the name of the blob container."
          }
        }
    },"variables": {},"resources": [
        {
            "type": "Microsoft.Storage/storageAccounts/blobServices/containers","apiVersion": "2019-06-01","name": "[concat(parameters('storageAccountName'),'/default/',parameters('containerName'))]","properties": {
                "publicAccess": "None"
            }
        }
    ]
}
本文链接:https://www.f2er.com/2154539.html

大家都在问