Challenge in attaching subnet and vnet configurations while creating azure container instances.
I am trying to create Azure container instances using the Azure SDK - Java/.Net. This container requires to communicate with components across different VMs. I was able to achieve this using Azure CLI commands with vnet and subnet configurations. But unable to replicate the same via SDK.
Code Snippet in Java
ContainerGroup containerGroup = azure.containerGroups().define(aciName).withRegion(Region.EUROPE_NORTH)
.withExistingResourceGroup(rgName).withLinux()
.withPrivateImageRegistry(registryServer, registryServerName, registryServerKey)
.defineVolume(volumeMountName).withExistingReadOnlyAzureFileShare(fileShareName)
.withStorageAccountName(storageAccountName).withStorageAccountKey(storageAccountKey).attach()
.defineContainerInstance(aciName).withImage(containerImageName).withExternalTcpPort(80)
.withVolumeMountSetting(volumeMountName, volumeMountPath).withCpuCoreCount(1)
.withMemorySizeInGB(1.5).withEnvironmentVariable("APP_PATH", volumeMountPath)
.withStartingCommandLine(commandLineArgs.toString()).attach().withDnsPrefix(aciName)
.withRestartPolicy(ContainerGroupRestartPolicy.NEVER).create();
Azure CLI
az container create --resource-group --name --image --cpu 1 --memory 1.5 --registry-login-server --registry-username --registry-password --azure-file-volume-share-name --azure-file-volume-account-name > --azure-file-volume-account-key --azure-file-volume-mount-path --restart-policy Never --e --subnet --subnet-address-prefix --vnet --vnet-name --subscription --command-line ""
Unable to attach the vnet and subnet configurations while creating azure container instances.