Solution to Azure: New-AzCdnProfile: Operation returned an invalid status code 'BadRequest'

448 Views Asked by At

I am using Pay-as-you-go subscription and i was using below Powershell command to create cdn profile.

 New-AzCdnProfile -ProfileName "cdnprofileforcache" -ResourceGroupName "rg-cdn" -Sku "Premium_Verizon" -Location "Uk South" -ErrorAction Stop -Verbose

it returns me with very minimal information as error.

New-AzCdnProfile : Operation returned an invalid status code 'BadRequest'
At line:1 char:1
+ New-AzCdnProfile -ProfileName "cdnprofileforcache" -ResourceGroupName "rg-cdn" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzCdnProfile], ErrorResponseException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Cdn.Profile.NewAzureRmCdnProfile
1

There are 1 best solutions below

0
On BEST ANSWER

After i try multiple option with Powershell i was trying to execute same command with Azure CLI and i got bellow error. Which makes more scenes to me.

az : ERROR: (LocationNotAvailableForResourceType) The provided location 'uksouth' is not available for resource type 'Microsoft.Cdn/profiles'. List of available regions for the resource type is 'global,australiaeast,australiasouth east,brazilsouth,canadacentral,canadaeast,centralindia,centralus,eastasia,eastus,eastus2,japaneast,japanwest,northcentralus,northeurope,southcentralus,southindia,southeastasia,westeurope,westindia,westus,westcentralus'. At line:1 char:1

  • az cdn profile create --name cdnprofiledelHub --resource-group "HUB" ...
  •   + CategoryInfo          : NotSpecified: (ERROR: (Locatio...westcentralus'.:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    
    

Then i try this Powershell command

Solutions :-

New-AzCdnProfile -ProfileName "cdnprofileforcache" -ResourceGroupName "rg-cdn" -Sku "Premium_Verizon" -Location Global -ErrorAction Stop -Verbose

Conclusion You need to use only those region where 'Microsoft.Cdn' provider does support. As of now (12/10/2021) Microsoft does support for only below regions. The below regions or location will change.

  1. global,
  2. australiaeast,
  3. australiasouth east,
  4. brazilsouth,
  5. canadacentral,
  6. canadaeast,
  7. centralindia,
  8. centralus,
  9. eastasia,
  10. eastus,
  11. eastus2,
  12. japaneast,
  13. japanwest,
  14. northcentralus,
  15. northeurope,
  16. southcentralus,
  17. southindia,
  18. southeastasia,
  19. westeurope,
  20. westindia,
  21. westus,
  22. westcentralus