Mounting more than one Azure File share is not possible with the New-AzContainerGroup command (nor Azure CLI). ARM template deployments do however support this. Can you suggest a programmatic way to deploy a container with multiple Azure File volumes?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for the question. We are currently investigating and will update you shortly.
This document contains information on the supported ways to deploy a container using ACI with multiple volumes: https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files#mount-multiple-volumes
Here are the options:
Azure Resource Manager template, https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files#deploy-container-and-mount-volume---resource-manager
YAML file, : https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files#deploy-container-and-mount-volume---yaml
or another programmatic method using the SDK of choice : e.g. here the ACI Client in Python: https://github.com/Azure-Samples/aci-docs-sample-python
@Karishma-Tiwari-MSFT thank you for the information!
@Karishma-Tiwari-MSFT Hi, I'm looking for the exact same stuff as the OP, but with Java SDK. I can mount a single volume, but I need two. Unfortunately, the Python example you provided doesn't seem to use multiple volumes at all. Is CLI my only option then?
@iozee While the example might no show an exact way of doing it, the SDK allows for it.
https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/containerinstance/mgmt-v2018_10_01
Here's a Java example on how to attach multiple VolumeMounts:
@Karishma-Tiwari-MSFT
// .withEmptyDirectoryVolume("emptydir1")
...
// Assert.assertEquals(1, containerGroup.volumes().size());
I'm afraid this line states that there's a single volume ("emptydir1") that's being attached.
Although I haven't found what I need, now I'm at least aware there's a public repository for SDK active development. Thank you!
This document contains information on the supported ways to deploy a container using ACI with multiple volumes: https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files#mount-multiple-volumes
Here are the options:
- Azure Resource Manager template, https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files#deploy-container-and-mount-volume---resource-manager
- YAML file, : https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files#deploy-container-and-mount-volume---yaml
- or another programmatic method using the SDK of choice : e.g. here the ACI Client in Python: https://github.com/Azure-Samples/aci-docs-sample-python
This is a nice addition to the original post, linking the material the original post identified as existing, but it does not answer the question of how to programmatically add multiple volumes to a container group. This issue should not have been closed. Specifically, using the nuget package Microsoft.Azure.Management.Fluent, it is only possible to add a single volume. While I can use a REST call with an ARM request body, it is significantly more cumbersome in the C# context. Are there intentions to expand the Fluent library or provide other options to support multiple volumes in a C# context?