Skip to content

New-AzContainerGroup throwing error for China with Module: Az.ContainerInstance:4.1.1 #27371

Open
@vandanchev

Description

@vandanchev

Description

Using Module: Az.ContainerInstance:4.1.1 to create a container instance in Azure China we get now errors. Using older version of the module we have no problems.

Az.ContainerInstance.internal\New-AzContainerGroup : No registered resource provider found for location 'chinaeast2' and API version '2024-05-01-preview' for type 'containerGroups'. The supported api-versions are '2017-08-01-preview, 2017-10-01-preview,
2017-12-01-preview, 2018-02-01-preview, 2018-04-01, 2018-06-01, 2018-07-01, 2018-09-01, 2018-10-01, 2019-12-01, 2020-11-01, 2021-03-01, 2021-07-01, 2021-09-01, 2021-10-01, 2022-04-01-preview, 2022-09-01, 2022-10-01-preview, 2023-02-01-preview, 2023-05-01,
2023-05-15-preview'. The supported locations are 'chinaeast2, chinanorth3'.

Issue script & Debug output

$env1 = New-AzContainerInstanceEnvironmentVariableObject -Name "DOMAIN" -Value "domain"

$container = New-AzContainerInstanceObject -Name vantest -Image single******102317 -EnvironmentVariable @($env1)

$credentials = "2Kzk95**********Hfyjr"

$imageRegistryCredential = New-AzContainerGroupImageRegistryCredentialObject -Server c****chi.azurecr.cn -Username c****chi -Password ($credentials | ConvertTo-SecureString -AsPlainText -Force) -Debug

New-AzContainerGroup -Name test**** -ResourceGroupName c*******x -Location chinaeast2 -IpAddressType Public -ImageRegistryCredential $imageRegistryCredential  -Container $container -Debug

DEBUG: AzureQoSEvent:  Module: Az.ContainerInstance:4.1.1; CommandName: New-AzContainerGroupImageRegistryCredentialObject; PSVersion: 5.1.26100.2161; IsSuccess: True; Duration: 00:00:00.0590595; SanitizeDuration: 00:00:00
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 13:27:55 - [ConfigManager] Got [True] from [DisplaySecretsWarning], Module = [], Cmdlet = [].
DEBUG: 13:27:55 - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 13:27:55 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Get-AzContext]. Returning default value [True].
DEBUG: 13:27:55 - [ConfigManager] Got [True] from [DisplaySecretsWarning], Module = [], Cmdlet = [].
DEBUG: 13:27:55 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 13:27:55 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 13:27:55 - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing: 
DEBUG: CmdletProcessRecordStart: 
DEBUG: CmdletGetPipeline: 
DEBUG: CmdletBeforeAPICall: 
DEBUG: URLCreated: /subscriptions/ee*******58c/resourceGroups/c***x/providers/Microsoft.ContainerInstance/containerGroups/test******?api-version=2024-05-01-preview
DEBUG: RequestCreated: /subscriptions/ee*****58c/resourceGroups/c****x/providers/Microsoft.ContainerInstance/containerGroups/test******?api-version=2024-05-01-preview
DEBUG: HeaderParametersAdded: 
DEBUG: BodyContentSet: 
DEBUG: 13:27:57 - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 13:27:57 - [ConfigManager] Got [False] from [EnableLoginByWam], Module = [], Cmdlet = [].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.chinacloudapi.cn/subscriptions/ee5*****8c/resourceGroups/c****x/providers/Microsoft.ContainerInstance/containerGroups/test*****?api-version=2024-05-01-preview

Headers:
x-ms-unique-id                : 1
x-ms-client-request-id        : c4eecdd0-a27a-4a44-8861-e33a6a1e4906
CommandName                   : Az.ContainerInstance.internal\New-AzContainerGroup
FullCommandName               : New-AzContainerGroup_CreateExpanded
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v0.0.0,PSVersion/v5.1.26100.2161,Az.ContainerInstance/4.1.0

Body:
{
  "location": "chinaeast2",
  "properties": {
    "ipAddress": {
      "ports": [
        {
          "port": 80
        }
      ],
      "type": "Public"
    },
    "containers": [
      {
        "properties": {
          "resources": {
            "requests": {
              "memoryInGB": 1.5,
              "cpu": 1
            }
          },
          "image": "single*****102317",
          "ports": [
            {
              "port": 80
            }
          ],
          "environmentVariables": [
            {
              "name": "DOMAIN",
              "value": "domain"
            }
          ]
        },
        "name": "vantest"
      }
    ],
    "imageRegistryCredentials": [
      {
        "server": "c****chi.azurecr.cn",
        "username": "c****chi",
        "password": "2Kzk95a***********fyjr"
      }
    ],
    "osType": "Linux"
  }
}


DEBUG: BeforeCall: 
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : 1f96ffca-7a08-42ed-9d25-c0ac3b460604
x-ms-correlation-request-id   : 1f96ffca-7a08-42ed-9d25-c0ac3b460604
x-ms-routing-request-id       : CHINANORTH:20250318T112759Z:1f96ffca-7a08-42ed-9d25-c0ac3b460604
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Tue, 18 Mar 2025 11:27:58 GMT

Body:
{
  "error": {
    "code": "NoRegisteredProviderFound",
    "message": "No registered resource provider found for location 'chinaeast2' and API version '2024-05-01-preview' for type 'containerGroups'. The supported api-versions are '2017-08-01-preview, 2017-10-01-preview, 2017-12-01-preview, 2018-02-01-preview, 2
018-04-01, 2018-06-01, 2018-07-01, 2018-09-01, 2018-10-01, 2019-12-01, 2020-11-01, 2021-03-01, 2021-07-01, 2021-09-01, 2021-10-01, 2022-04-01-preview, 2022-09-01, 2022-10-01-preview, 2023-02-01-preview, 2023-05-01, 2023-05-15-preview'. The supported location
s are 'chinaeast2, chinanorth3'."
  }
}


DEBUG: ResponseCreated: 
DEBUG: BeforeResponseDispatch: 
Az.ContainerInstance.internal\New-AzContainerGroup : No registered resource provider found for location 'chinaeast2' and API version '2024-05-01-preview' for type 'containerGroups'. The supported api-versions are '2017-08-01-preview, 2017-10-01-preview, 
2017-12-01-preview, 2018-02-01-preview, 2018-04-01, 2018-06-01, 2018-07-01, 2018-09-01, 2018-10-01, 2019-12-01, 2020-11-01, 2021-03-01, 2021-07-01, 2021-09-01, 2021-10-01, 2022-04-01-preview, 2022-09-01, 2022-10-01-preview, 2023-02-01-preview, 2023-05-01, 
2023-05-15-preview'. The supported locations are 'chinaeast2, chinanorth3'.
At C:\Program Files\WindowsPowerShell\Modules\Az.ContainerInstance\4.1.1\ContainerInstance.Autorest\custom\New-AzContainerGroup.ps1:349 char:7
+       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundPara ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ SubscriptionI...inux"
  }
} }:<>f__AnonymousType11`4) [New-AzContainerGroup_CreateExpanded], Exception
    + FullyQualifiedErrorId : NoRegisteredProviderFound,Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Cmdlets.NewAzContainerGroup_CreateExpanded
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally: 
DEBUG: CmdletAfterAPICall: 
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd: 
DEBUG: CmdletProcessRecordEnd: 
DEBUG: AzureQoSEvent:  Module: Az.ContainerInstance:4.1.1; CommandName: New-AzContainerGroup; PSVersion: 5.1.26100.2161; IsSuccess: False; Duration: 00:00:07.8564727; SanitizeDuration: 00:00:00; Exception: InternalException;

Environment data

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
PSVersion                      5.1.26100.2161                                                                                                                                                                                                                    
PSEdition                      Desktop                                                                                                                                                                                                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                           
BuildVersion                   10.0.26100.2161                                                                                                                                                                                                                   
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                                   
WSManStackVersion              3.0                                                                                                                                                                                                                               
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                               
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands                                                                                                                                                                                       
---------- -------    ----                                ----------------                                                                                                                                                                                       
Script     4.0.2      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}                                                                                                                               
Script     4.1.1      Az.ContainerInstance                {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-AzContainerInstanceCachedImage, Get-AzContainerInstanceCapability...}

Error output

Message        : [NoRegisteredProviderFound] : No registered resource provider found for location 'chinaeast2' and API version '2024-05-01-preview' for type 'containerGroups'. The supported api-versions are '2017-08-01-preview, 2017-10-01-preview, 
                 2017-12-01-preview, 2018-02-01-preview, 2018-04-01, 2018-06-01, 2018-07-01, 2018-09-01, 2018-10-01, 2019-12-01, 2020-11-01, 2021-03-01, 2021-07-01, 2021-09-01, 2021-10-01, 2022-04-01-preview, 2022-09-01, 2022-10-01-preview, 
                 2023-02-01-preview, 2023-05-01, 2023-05-15-preview'. The supported locations are 'chinaeast2, chinanorth3'.
StackTrace     : 
Exception      : System.Exception
InvocationInfo : {New-AzContainerGroup_CreateExpanded}
Line           :       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundParameters
                 
Position       : At C:\Program Files\WindowsPowerShell\Modules\Az.ContainerInstance\4.1.1\ContainerInstance.Autorest\custom\New-AzContainerGroup.ps1:349 char:7
                 +       Az.ContainerInstance.internal\New-AzContainerGroup @PSBoundPara ...
                 +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure PS TeamContainer Instancescustomer-reportedneeds-team-attentionThis issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions