Azure / Azure/azure-cli

--network-profile does not accept custom network profile names

Open
#15,029 5 comments 1 reaction 0 assignees View on GitHub
act-observability-squad Container Instances customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Summary

Trying to place an ACI container into a subnet within a vnet with a really long name fails due to network profiles.

## Description

I tried to add an ACI container into a subnet within a vNet whose RG was different than the one belonging to the container. In other words, given subnet `SUBNET-x1EwoIU3fUlU3yHZrbr6J10thCvkRC` which exists in vnet `VNET-6Ck2ICBzlac4SWRV2MUFtXnLzUKXjA` which resides in resource group `NET-RG`, I wanted to deploy an ACI container into resource group `ACI-RG`.

Unfortunately, I was unable to do so due to the auto-generated network profile name (`aci-network-profile-VNET-6Ck2ICBzlac4SWRV2MUFtXnLzUKXjA-SUBNET-x1EwoIU3fUlU3yHZrbr6J10thCvkRC`) being too long.

I tried to get around this by providing `--network-profile my-custom-profile-name`, but this fails because `my-custom-profile-name` hasn't been created yet. However, there is no way to create this network profile aside from running `az container create` despite `Microsoft.Network/networkProfiles` being able to [accept `PUT`s](https://docs.microsoft.com/en-us/rest/api/virtualnetwork/networkprofiles/createorupdate).

## Workaround

The only way we were able to get around this was by shortening the subnet name. This might be a prohibitive action in restrictive or heavily-regulated environments.

## See Also

- This is where `networkProfile` is getting validated: https://github.com/Azure/azure-cli/blob/bdda8e3089f7ce14f9287b1079b2d2e4f9849e40/src/azure-cli/azure/cli/command_modules/container/_validators.py#L90

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.