Created a container instance but not able to view storage account associated with it

Jaanvi Dhariwal 40 Reputation points
2023-05-15T12:47:57.6366667+00:00

I have tried to deploy a pre existing container instance arm template from a subscription, I'm not able to see the storage account, as storage account access key has to be given for successful deployment.

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "containerGroups_sftp_group_name": {
            "defaultValue": "sftp-group",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.ContainerInstance/containerGroups",
            "apiVersion": "2023-05-01",
            "name": "[parameters('containerGroups_sftp_group_name')]",
            "location": "eastus",
            "properties": {
                "sku": "Standard",
                "containers": [
                    {
                        "name": "sftp",
                        "properties": {
                            "image": "atmoz/sftp:debian",
                            "ports": [
                                {
                                    "protocol": "TCP",
                                    "port": 22
                                }
                            ],
                            "environmentVariables": [
                                {
                                    "name": "SFTP_USERS"
                                }
                            ],
                            "resources": {
                                "requests": {
                                    "memoryInGB": 1,
                                    "cpu": 1
                                }
                            },
                            "volumeMounts": [
                                {
                                    "name": "sftpvolume",
                                    "mountPath": "/home/sftpinnovation/upload",
                                    "readOnly": false
                                }
                            ]
                        }
                    }
                ],
                "initContainers": [],
                "restartPolicy": "OnFailure",
                "ipAddress": {
                    "ports": [
                        {
                            "protocol": "TCP",
                            "port": 22
                        }
                    ],
              
                    "type": "Public",
                    "dnsNameLabel": "2sz5y3qbciga",
                    "autoGeneratedDomainNameLabelScope": "Unsecure"
                },
                "osType": "Linux",
                "volumes": [
                    {
                        "name": "sftpvolume",
                        "azureFile": {
                            "shareName": "sftpfilesharecopy",
                            "readOnly": false,
                            "storageAccountName": "sftpstgcopykknuri35dxbgs"
                        }
                    }
                ]
            }
        }
    ]
}
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
676 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,639 questions
{count} votes

Accepted answer
  1. vipullag-MSFT 26,021 Reputation points
    2023-05-15T14:18:17.4433333+00:00

    Hello Jaanvi Dhariwal

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    As you have deployed a pre-existing container instance ARM template from a subscription, in the ARM template you have shared storageAccountKey property is not present.

    You need to add the storage account access key to the template and try to redeploy the container instance.

    Here's an example of how you can add the storage account access key to the ARM template:

    "volumes": [
        {
            "name": "sftpvolume",
            "azureFile": {
                "shareName": "sftpfilesharecopy",
                "readOnly": false,
                "storageAccountName": "sftpstgcopykknuri35dxbgs",
                "storageAccountKey": "<storage-account-access-key>"
            }
        }
    ]
    

    Replace <storage-account-access-key> with the access key for the storage account.

    Ref: https://learn.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal#view-account-access-keys

    Once you have added the storage account access key to the ARM template, you can redeploy the container instance. After the deployment is complete, you should be able to see the storage account associated with the container instance.

    Make sure you have the necessary permissions to access the storage account. Ensure that you have the correct role assignments or access control settings for the storage account.

    Check if there are any network restrictions or firewall rules that might be preventing access to the storage account. Ensure that the necessary ports for accessing the storage account are open.

    Verify that the storage account and the container instance are deployed in the same resource group. If they are in different resource groups, you may not see the storage account in the context of the container instance.

    Hope this helps.


0 additional answers

Sort by: Most helpful