skip to Main Content

I’m trying to deploy container with yml. Deployment file looks like this:

apiVersion: 2019-12-01
location: westeurope
name: imgeneus-login
properties:

  imageRegistryCredentials:
    - server: imgeneusregistrytest.azurecr.io
      username: imgeneusregistrytest
      password: #{registryPassword}#

  restartPolicy: OnFailure

  containers:
  - name: imgeneus-login
    properties:
      image: imgeneusregistrytest.azurecr.io/imgeneus.login:latest
      resources:
        requests:
          cpu: 1
          memoryInGb: 1
      ports:
      - port: 80
      - port: 30800

      environmentVariables:
      - name: Database__Host
        value: imgeneus-test.mysql.database.azure.com
      - name: Database__Username
        value: aosyatnik
      - name: Database__Password
        value: #{dbPassword}#
      - name: Database__SslMode
        value: Required
      - name: TcpServer__Host
        value: "0.0.0.0"

  osType: Linux
  ipAddress:
      type: Private
      ports:
      - protocol: tcp
        port: 80
      - protocol: tcp
        port: 30800
  subnetIds:
   - id: /subscriptions/503236c4-a00c-466c-b7b0-4800e8dec527/resourceGroups/imgeneus-test/providers/Microsoft.Network/virtualNetworks/imgeneus-test/subnets/imgeneus-test
     name: imgeneus-test

type: Microsoft.ContainerInstance/containerGroups

I’m pretty sure, that it’s possible to deploy on private network, as described here: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-application-gateway

But in article they are doing it via terminal.

But it fails with error: Code: PrivateIPAddressNotSupported Message: IP Address type in container group 'imgeneus-login' is invalid. Private IP address is only supported when network profile is defined.

I can not find in documentation, how should I provide private network? "network profile is defined" what does it mean?

2

Answers


  1. Code: PrivateIPAddressNotSupported Message: IP Address type in
    container group ‘imgeneus-login’ is invalid. Private IP address is
    only supported when network profile is defined

    you need to create a intial container instance using az container instance then only you will able to get network profile and based on which later you can deploy using the YAML defination to the same subnet.

    Resaon for above : With the YAML file, you only can specify the network information with network profile id, Refer this.

    You can refer this thread for detailed information which encounter the same issue prevoious year

    In this official microsoft document you will also get to observe that in starting it creating a first container instance using az container instance and that create a network profile that helping to create a second container instance with private IP using CLI or YAML.

    I am trying to reproduce the same in my environment but seems i have few restrication(Policy enable in my Azure Account) to create it. I need to get consent from my admin. But you can try the above suggestion it might works for you.

    If still doesn’t work then note the below words and reach out to Azure Support to confirm the same.

    Network profiles have been deprecated as of the 2021-07-01 API
    version. If you’re using this or a more recent version, ignore any
    steps and actions related to network profiles.

    Login or Signup to reply.
  2. I was also stuck with this same error. What helped in my case was to change the api-version used in the yaml file. I changed it from:
    apiVersion: ‘2019-12-01’
    to:
    apiVersion: ‘2021-07-01’

    As documented here:
    https://learn.microsoft.com/en-us/azure/container-instances/container-instances-vnet#example—yaml

    And that allowed it to proceed with the deployment of the container.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search