Hello,
i´m trying to create an ARM template to create a Resource Group, Storage Account, File Share and Container Instance all in one go.
It´s working apart from the Container Instance (which should mount the previously created file share), and its failing when getting the Storage Account key for this mount.
I´m trying to get the key like this:
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('varStorageAccountName')), '2019-04-01').keys[0].value]"
but it gives me the error message:
The Resource 'Microsoft.Storage/storageAccounts/igen5neo4jstorage' under resource group '<null>' was not found."
I´m starting the deployment with
az deployment create --location westeurope --template-file complete_arm_file.json
Is there somehing i am simply missing (evtl. just the correct way to refrence the Storage Account in the subscription-scoped deployment ), or doesn´t it work as i intend to do? Here is the complete template i have till now:
{"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {"paramLocation": {"defaultValue": "westeurope","type": "String" },"paramEnvironment": {"defaultValue": "igen5","type": "String" },"paramTargetName":{"defaultValue": "neo4j","type":"string" },"paramDockerImage":{"defaultValue": "bitnami/neo4j:4.0.1","type":"string" } },"variables": {"varResourceGroupName": "[concat(parameters('paramEnvironment'), parameters('paramTargetName'),'rg')]","varContainerGroupName": "[concat(parameters('paramEnvironment'), parameters('paramTargetName'),'aci')]","varStorageAccountName": "[concat(parameters('paramEnvironment'), parameters('paramTargetName'),'storage')]","varFileShareName": "[concat(parameters('paramEnvironment'), parameters('paramTargetName'),'acibitnami')]" },"resources": [ {"type": "Microsoft.Resources/resourceGroups","apiVersion": "2018-05-01","location": "[parameters('paramLocation')]","name": "[variables('varResourceGroupName')]","properties": {} }, {"type": "Microsoft.Resources/deployments","apiVersion": "2018-05-01","name": "storageDeployment","resourceGroup": "[variables('varResourceGroupName')]","dependsOn": ["[resourceId('Microsoft.Resources/resourceGroups/', variables('varResourceGroupName'))]" ],"properties": {"mode": "Incremental","template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {},"variables": {},"resources": [ {"type": "Microsoft.Storage/storageAccounts","apiVersion": "2017-10-01","name": "[variables('varStorageAccountName')]","location": "[parameters('paramLocation')]","sku": {"name": "Standard_LRS" },"kind": "StorageV2" }, {"type": "Microsoft.Storage/storageAccounts/fileServices/shares","apiVersion": "2019-04-01","name": "[concat(variables('varStorageAccountName'), '/default/', variables('varFileShareName'))]","dependsOn": ["[resourceId('Microsoft.Storage/storageAccounts', variables('varStorageAccountName'))]" ] }, {"type": "Microsoft.Resources/deployments","apiVersion": "2018-05-01","name": "aciDeployment","resourceGroup": "[variables('varResourceGroupName')]","dependsOn": ["[resourceId('Microsoft.Storage/storageAccounts', variables('varStorageAccountName'))]" ],"properties": {"mode": "Incremental","template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {},"variables": {},"resources": [ {"type": "Microsoft.ContainerInstance/containerGroups","apiVersion": "2018-10-01","name": "[variables('varContainerGroupName')]","location": "[parameters('paramLocation')]","properties": {"containers": [ {"name": "[variables('varContainerGroupName')]","properties": {"image": "[parameters('paramDockerImage')]","ports": [ {"protocol": "TCP","port": 80 }, {"protocol": "TCP","port": 7687 }, {"protocol": "TCP","port": 7474 }, {"protocol": "TCP","port": 7473 } ],"environmentVariables": [],"resources": {"requests": {"memoryInGB": 1.5,"cpu": 1 } },"volumeMounts": [ {"name": "bitnamipersistvolume","mountPath": "/bitnami" } ] } } ],"restartPolicy": "OnFailure","ipAddress": {"ports": [ {"protocol": "TCP","port": 80 }, {"protocol": "TCP","port": 7687 }, {"protocol": "TCP","port": 7474 }, {"protocol": "TCP","port": 7473 } ],"type": "Public","dnsNameLabel": "[variables('varContainerGroupName')]" },"osType": "Linux","volumes": [ {"name": "bitnamipersistvolume","azureFile": {"shareName": "[variables('varFileShareName')]","storageAccountName": "[variables('varStorageAccountName')]","storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('varStorageAccountName')), '2019-04-01').keys[0].value]" } } ] } } ],"outputs": {} } } } ],"outputs": {} } } } ],"outputs": {} }
I´ve also tried to put the ACI-Part not as another nested deployment but just as another resource in the inner deloyment. with the same result.
Thank you!