Skip to content

Commit 65ef894

Browse files
authored
Merge pull request #57189 from dlepow/acifix1
ACI: Mounting Azure Files share
2 parents 63a40ed + 6880e4f commit 65ef894

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

articles/container-instances/container-instances-volume-azure-files.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
title: Mount an Azure Files volume in Azure Container Instances
33
description: Learn how to mount an Azure Files volume to persist state with Azure Container Instances
44
services: container-instances
5-
author: seanmck
5+
author: dlepow
66
manager: jeconnoc
77

88
ms.service: container-instances
99
ms.topic: article
10-
ms.date: 02/20/2018
11-
ms.author: seanmck
10+
ms.date: 11/05/2018
11+
ms.author: danlep
1212
ms.custom: mvc
1313
---
1414

1515
# Mount an Azure file share in Azure Container Instances
1616

17-
By default, Azure Container Instances are stateless. If the container crashes or stops, all of its state is lost. To persist state beyond the lifetime of the container, you must mount a volume from an external store. This article shows how to mount an Azure file share for use with Azure Container Instances.
17+
By default, Azure Container Instances are stateless. If the container crashes or stops, all of its state is lost. To persist state beyond the lifetime of the container, you must mount a volume from an external store. This article shows how to mount an Azure file share created with [Azure Files](../storage/files/storage-files-introduction.md) for use with Azure Container Instances. Azure Files offers fully managed file shares in the cloud that are accessible via the industry standard Server Message Block (SMB) protocol. Using an Azure file share with Azure Container Instances provides file-sharing features similar to using an Azure file share with Azure virtual machines.
1818

1919
> [!NOTE]
2020
> Mounting an Azure Files share is currently restricted to Linux containers. While we are working to bring all features to Windows containers, you can find current platform differences in [Quotas and region availability for Azure Container Instances](container-instances-quotas.md).
@@ -37,29 +37,24 @@ az storage account create \
3737
--location $ACI_PERS_LOCATION \
3838
--sku Standard_LRS
3939
40-
# Export the connection string as an environment variable. The following 'az storage share create' command
41-
# references this environment variable when creating the Azure file share.
42-
export AZURE_STORAGE_CONNECTION_STRING=`az storage account show-connection-string --resource-group $ACI_PERS_RESOURCE_GROUP --name $ACI_PERS_STORAGE_ACCOUNT_NAME --output tsv`
43-
4440
# Create the file share
45-
az storage share create -n $ACI_PERS_SHARE_NAME
41+
az storage share create --name $ACI_PERS_SHARE_NAME --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME
4642
```
4743

4844
## Get storage credentials
4945

5046
To mount an Azure file share as a volume in Azure Container Instances, you need three values: the storage account name, the share name, and the storage access key.
5147

52-
If you used the script above, the storage account name was created with a random value at the end. To query the final string (including the random portion), use the following commands:
48+
If you used the script above, the storage account name was stored in the $ACI_PERS_STORAGE_ACCOUNT_NAME variable. To see the account name, type:
5349

54-
```azurecli-interactive
55-
STORAGE_ACCOUNT=$(az storage account list --resource-group $ACI_PERS_RESOURCE_GROUP --query "[?contains(name,'$ACI_PERS_STORAGE_ACCOUNT_NAME')].[name]" --output tsv)
56-
echo $STORAGE_ACCOUNT
50+
```console
51+
echo $ACI_PERS_STORAGE_ACCOUNT_NAME
5752
```
5853

5954
The share name is already known (defined as *acishare* in the script above), so all that remains is the storage account key, which can be found using the following command:
6055

6156
```azurecli-interactive
62-
STORAGE_KEY=$(az storage account keys list --resource-group $ACI_PERS_RESOURCE_GROUP --account-name $STORAGE_ACCOUNT --query "[0].value" --output tsv)
57+
STORAGE_KEY=$(az storage account keys list --resource-group $ACI_PERS_RESOURCE_GROUP --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)
6358
echo $STORAGE_KEY
6459
```
6560

@@ -84,7 +79,7 @@ The `--dns-name-label` value must be unique within the Azure region you create t
8479

8580
## Manage files in mounted volume
8681

87-
Once the container starts up, you can use the simple web app deployed via the [microsoft/aci-hellofiles][aci-hellofiles] image to manage the files in the Azure file share at the mount path you specified. Obtain the web app's fully qualified domain name (FQDN) with the [az container show][az-container-show] command:
82+
Once the container starts up, you can use the simple web app deployed via the [microsoft/aci-hellofiles][aci-hellofiles] image to create small text files in the Azure file share at the mount path you specified. Obtain the web app's fully qualified domain name (FQDN) with the [az container show][az-container-show] command:
8883

8984
```azurecli-interactive
9085
az container show --resource-group $ACI_PERS_RESOURCE_GROUP --name hellofiles --query ipAddress.fqdn
@@ -94,11 +89,11 @@ You can use the [Azure portal][portal] or a tool like the [Microsoft Azure Stora
9489

9590
## Mount multiple volumes
9691

97-
To mount multiple volumes in a container instance, you must deploy using an [Azure Resource Manager template](/azure/templates/microsoft.containerinstance/containergroups).
92+
To mount multiple volumes in a container instance, you must deploy using an [Azure Resource Manager template](/azure/templates/microsoft.containerinstance/containergroups) or a YAML file.
9893

99-
First, provide the share details and define the volumes by populating the `volumes` array in the `properties` section of the template. For example, if you've created two Azure Files shares named *share1* and *share2* in storage account *myStorageAccount*, the `volumes` array would appear similar to the following:
94+
To use a template, provide the share details and define the volumes by populating the `volumes` array in the `properties` section of the template. For example, if you've created two Azure Files shares named *share1* and *share2* in storage account *myStorageAccount*, the `volumes` array would appear similar to the following:
10095

101-
```json
96+
```JSON
10297
"volumes": [{
10398
"name": "myvolume1",
10499
"azureFile": {
@@ -119,7 +114,7 @@ First, provide the share details and define the volumes by populating the `volum
119114

120115
Next, for each container in the container group in which you'd like to mount the volumes, populate the `volumeMounts` array in the `properties` section of the container definition. For example, this mounts the two volumes, *myvolume1* and *myvolume2*, previously defined:
121116

122-
```json
117+
```JSON
123118
"volumeMounts": [{
124119
"name": "myvolume1",
125120
"mountPath": "/mnt/share1/"
@@ -130,7 +125,7 @@ Next, for each container in the container group in which you'd like to mount the
130125
}]
131126
```
132127

133-
To see an example of container instance deployment with an Azure Resource Manager template, see [Deploy multi-container groups in Azure Container Instances](container-instances-multi-container-group.md).
128+
To see an example of container instance deployment with an Azure Resource Manager template, see [Deploy a container group](container-instances-multi-container-group.md). For an example using a YAML file, see [Deploy a multi-container group with YAML](container-instances-multi-container-yaml.md)
134129

135130
## Next steps
136131

0 commit comments

Comments
 (0)