question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not use "--network-profile" with IP address type "Public"

See original GitHub issue

Describe the bug

Even with --ip-address Private i’m getting error message that IP address type is “Public” Location: West Europe

Command Name az container create

Errors:

Can not use "--network-profile" with IP address type "Public".

To Reproduce:

  • Create or have an existing networking profile pointing to a specific subnet inside VNET
  • az container create --resource-group myresourcegroup --ip-address Private --name testcli --image nginx --network-profile profilename

Expected Behavior

Container is created.

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.18.0

Extensions:
azure-devops 0.18.0

Additional Context

I swear this used to work. Below is the details of the networking profile.

[
  {
    "containerNetworkInterfaceConfigurations": [
      {
        "containerNetworkInterfaces": [
          {
            "id": "***",
            "resourceGroup": "myresourcegroup"
          },
          {
            "id": "***",
            "resourceGroup": "myresourcegroup"
          }
        ],
        "etag": "W/\"f993fb7a-d846-48f4-9fb7-4cc70b9f8691\"",
        "id": "***",
        "ipConfigurations": [
          {
            "etag": "W/\"f993fb7a-d846-48f4-9fb7-4cc70b9f8691\"",
            "id": "***",
            "name": "ci_subnet_ipconf",
            "provisioningState": "Succeeded",
            "resourceGroup": "myresourcegroup",
            "subnet": {
              "addressPrefix": null,
              "addressPrefixes": null,
              "delegations": null,
              "etag": null,
              "id": "***",
              "ipAllocations": null,
              "ipConfigurationProfiles": null,
              "ipConfigurations": null,
              "name": null,
              "natGateway": null,
              "networkSecurityGroup": null,
              "privateEndpointNetworkPolicies": null,
              "privateEndpoints": null,
              "privateLinkServiceNetworkPolicies": null,
              "provisioningState": null,
              "purpose": null,
              "resourceGroup": "vnet-resource-group",
              "resourceNavigationLinks": null,
              "routeTable": null,
              "serviceAssociationLinks": null,
              "serviceEndpointPolicies": null,
              "serviceEndpoints": null
            },
            "type": "Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"
          }
        ],
        "name": "ci_subnet_cni",
        "provisioningState": "Succeeded",
        "resourceGroup": "myresourcegroup",
        "type": "Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"
      }
    ],
    "containerNetworkInterfaces": [
      {
        "container": {
          "id": "",
          "resourceGroup": "myresourcegroup"
        },
        "containerNetworkInterfaceConfiguration": {
          "containerNetworkInterfaces": null,
          "etag": null,
          "id": "***",
          "ipConfigurations": null,
          "name": null,
          "provisioningState": null,
          "resourceGroup": "myresourcegroup",
          "type": null
        },
        "etag": "W/\"f993fb7a-d846-48f4-9fb7-4cc70b9f8691\"",
        "id": "***",
        "ipConfigurations": [],
        "name": "bec970e9-3411-4377-9960-ef1492f790d2_ci_subnet_cni",
        "provisioningState": "Succeeded",
        "resourceGroup": "myresourcegroup",
        "type": "Microsoft.Network/networkProfiles/containerNetworkInterfaces"
      },
      {
        "container": {
          "id": "***",
          "resourceGroup": "myresourcegroup"
        },
        "containerNetworkInterfaceConfiguration": {
          "containerNetworkInterfaces": null,
          "etag": null,
          "id": "***",
          "ipConfigurations": null,
          "name": null,
          "provisioningState": null,
          "resourceGroup": "myresourcegroup",
          "type": null
        },
        "etag": "W/\"f993fb7a-d846-48f4-9fb7-4cc70b9f8691\"",
        "id": "***",
        "ipConfigurations": [],
        "name": "63beb899-e461-4a7b-a70e-20e9fc4ccd40_ci_subnet_cni",
        "provisioningState": "Succeeded",
        "resourceGroup": "myresourcegroup",
        "type": "Microsoft.Network/networkProfiles/containerNetworkInterfaces"
      }
    ],
    "etag": "W/\"f993fb7a-d846-48f4-9fb7-4cc70b9f8691\"",
    "id": "***",
    "location": "westeurope",
    "name": "profilename",
    "provisioningState": "Succeeded",
    "resourceGroup": "myresourcegroup",
    "resourceGuid": "***",
    "tags": {},
    "type": "Microsoft.Network/networkProfiles"
  }
]

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

3reactions
davehcdncommented, Feb 5, 2021

Just remove the --ip-address Private if you are specifying a Network Profile and it should create it with a private IP anyways - that might be a workaround - it seemed to work for us.

0reactions
ungurflorincommented, Oct 28, 2021

@davehcdn your workaround only works if the resource doesn’t exist prior to executing the command. Removing the --ip-address Private parameter and executing the command gives us the following error:

(InvalidContainerGroupUpdate) The updates on container group 'test' are invalid. If you are going to update the os type, restart policy, network profile, CPU, memory or GPU resources for a container group, you must delete it first and then create a new one.

For context, we have the same issue as OP. The full command we execute is:

az container create `
    --resource-group $VnetResourceGroup `
    --name $ContainerName `
    --vnet $VnetName `
    --subnet $SubnetName `
    --ip-address Private `
    --image $ImageName `
    --environment-variables $env1 $env2 `
    --registry-username $AcrUser `
    --registry-password $AcrPass `
    --cpu 1 `
    --memory 1 `
    --os-type Linux

This command worked with the following CLI versions:

{
  "azure-cli": "2.24.2",
  "azure-cli-core": "2.24.2",    
  "azure-cli-telemetry": "1.0.6"
}
{
  "azure-cli": "2.28.0",
  "azure-cli-core": "2.28.0",    
  "azure-cli-telemetry": "1.0.6"
}

And, I assume, every CLI version in between these two. Worth noting that with us, unlike OP, an older version of the CLI works. Didn’t test with their version (2.18.0) though.

The Can not use "--network-profile" with IP address type "Public" error appeared in version 2.29.0 and persists in version 2.29.1 for us.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot change network profile from Public to Private
1. Windows Key+I to invoke Settings > Network & Internet > Wi-Fi (or any other choice as per your requirement) > Manage known...
Read more >
Azure Container Instances: deploy to private ip with yml
Private IP address is only supported when network profile is defined. I can not find in documentation, how should I provide private network?...
Read more >
Learn more about network profiles in vRealize Automation ...
When using static IP, the address range is managed by vRealize ... in a blueprint that have a network type: public property are...
Read more >
Use private Wi-Fi addresses on iPhone, iPad, iPod touch, and ...
If the device always uses the same Wi-Fi MAC address across all networks, network operators and other network observers can more easily relate ......
Read more >
What is a Private IP Address?
Because — and you may not realize this — you have both a public and a ... As a matter of fact, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found