How to deploy an Azure Files storage share into a container using a json template

Zubin Sethna 21 Reputation points
2025-05-04T06:48:23.44+00:00

In my storage account I've created an Azure Files share that I want to add to a Linux container that I already have deployed. What I want to do is redeploy the container using an ARM template with the file share mounted. How exactly to do this?

The existing template for the container looks like this (some fields anonymised) :

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "containerGroups_tds_name": {
            "defaultValue": "tds",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.ContainerInstance/containerGroups",
            "apiVersion": "2024-10-01-preview",
            "name": "[parameters('containerGroups__name')]",
            "location": <azure location>",
            "properties": {
                "sku": "Standard",
                "containers": [
                    {
                        "name": "[parameters('containerGroups__name')]",
                        "properties": {
                            "image": "[concat(<image name>), ':latest')]",
                            "command": [
                                "/bin/bash",
                                "-c",
                                "echo Hello; service apache2 restart; sleep infinity"
                            ],
                            "ports": [
                                {
                                    "protocol": "TCP",
                                    "port": 80
                                },
                                {
                                    "protocol": "TCP",
                                    "port": 19390
                                }
                            ],
                            "environmentVariables": [],
                            "resources": {
                                "requests": {
                                    "memoryInGB": 1.5,
                                    "cpu": 1
                                }
                            }
                        }
                    }
                ],
                "initContainers": [],
                "imageRegistryCredentials": [
                    {
                        "server": "<server>",
                        "username": "<uname>"
                    }
                ],
                "restartPolicy": "OnFailure",
                "ipAddress": {
                    "ports": [
                        {
                            "protocol": "TCP",
                            "port": 80
                        }
                    ],
                    "ip": "<ip address>",
                    "type": "Public",
                    "dnsNameLabel": "[concat(parameters('containerGroups__name'), '<something>')]",
                    "autoGeneratedDomainNameLabelScope": "TenantReuse"
                },
                "osType": "Linux"
            }
        }
    ]
}

For the storage account I have the share name, storage account name and the storage account key. Plus of course the mount point inside the Linux container where I want to access the storage. So how can I do this?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
751 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.