How to Set DNS Prefix in Azure.ResourceManager.ContainerInstance SDK?

Abderrahmane ElMostapha IZRI 30 Reputation points
2024-11-25T20:40:59.45+00:00

In the deprecated SDK Microsoft.Azure.Management.ContainerInstance.Fluent.ContainerGroup.Definition you can set the container's DNS prefix with IWithDnsPrefix.WithDnsPrefix(String) method. What replaced it in the new .NET SDK Azure.ResourceManager.ContainerInstance?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,109 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Abderrahmane ElMostapha IZRI 30 Reputation points
    2024-11-26T15:12:04.3633333+00:00

    I think it's in the ContainerGroupData.IPAddress Property.
    Example:

    var containerGroupData = new ContainerGroupData(azureLocation, listContainerInstanceContainer, containerInstanceOperatingSystemType)
    {
        IPAddress = new ContainerGroupIPAddress(new List<ContainerGroupPort> { new (1234) }, ContainerGroupIPAddressType.Public)
        {
            DnsNameLabel = yourDnsPrefix
        }
    };
    
    0 comments No comments

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.