Azure-cli: az aks update: error: argument --api-server-authorized-ip-ranges: expected one argument

Created on 12 Mar 2020  路  16Comments  路  Source: Azure/azure-cli

When running the aks update for authorized IP range i am getting the below error

az aks update --resource-group aks-poc-seab
--name aksseabpoc `
--api-server-authorized-ip-ranges

az aks update: error: argument --api-server-authorized-ip-ranges: expected one argument

AKS Service Attention

Most helpful comment

@nidiculageorge @pvasek Are you using Powershell? You can pass --api-server-authorized-ip-ranges= instead of --api-server-authorized-ip-ranges "" for empty string. Powershell has known issues to strip double quotes when passing parameters in a batch script which is what our az.cmd/az.bat does.

A more general workaround is to replace one double quotes with three double quotes --api-server-authorized-ip-ranges """""" or add stop-parsing symbol --% after az: az --% aks update --resource-group myResourceGroup --name myAKSCluster --api-server-authorized-ip-ranges "". More about quoting issues in our doc.

All 16 comments

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm.

thanks for reporting, we are looking at it

any update on the below

We are trying to delete the IP authorization

https://docs.microsoft.com/en-us/azure/aks/api-server-authorized-ip-ranges

az aks update \
--resource-group myResourceGroup \
--name myAKSCluster \
--api-server-authorized-ip-ranges ""

This is the command but its not running

hi @jluk could you have a look at this?

An empty string is required like the second command you ran

az aks update --resource-group myResourceGroup --name myAKSCluster --api-server-authorized-ip-ranges ""

Can you share the error message returned when running that? The original post shows an error that will return if the empty string is not passed in.

Hi Jluk,

I was geeting the same error as before when using the "" also

az aks update --resource-group <rgname>
--name `
--api-server-authorized-ip-ranges ""

any update

which cli version are you using ? and can you copy paste the error?

@feiskyer FYI

Having the same issue. Running command:

az aks update --resource-group my-resource-group --name my-aks --api-server-authorized-ip-ranges ""

returns:

az aks update: error: argument --api-server-authorized-ip-ranges: expected one argument

az version -o json returns:

This command is in preview. It may be changed/removed in a future release.
  "azure-cli": "2.2.0",
  "azure-cli-command-modules-nspkg": "2.0.3",
  "azure-cli-core": "2.2.0",
  "azure-cli-telemetry": "1.0.4",
  "extensions": {}
}

Just updated to _Azure CLI 2.2_ before I had _Azure CLI 2.1_ but error was the same.

But running that in https://shell.azure.com gives me completely different error:

Operation failed with status: 'Bad Request'. Details: Changing enablePrivateCluster is not allowed. It can only be set while creating the cluster.

Details: Changing enablePrivateCluster is not allowed issue has been fixed by #12589.

For the first error, I couldn't reproduce it. @yonzhan have you seen similar errors on other CLI commands?

Details: Changing enablePrivateCluster is not allowed issue has been fixed by #12589.

For the first error, I couldn't reproduce it. @yonzhan have you seen similar errors on other CLI commands?

hi @fengzhou-msft could you pls help to look at the error to see if it caused by empty string? thanks

@nidiculageorge @pvasek Are you using Powershell? You can pass --api-server-authorized-ip-ranges= instead of --api-server-authorized-ip-ranges "" for empty string. Powershell has known issues to strip double quotes when passing parameters in a batch script which is what our az.cmd/az.bat does.

A more general workaround is to replace one double quotes with three double quotes --api-server-authorized-ip-ranges """""" or add stop-parsing symbol --% after az: az --% aks update --resource-group myResourceGroup --name myAKSCluster --api-server-authorized-ip-ranges "". More about quoting issues in our doc.

@fengzhou-msft you are right, I am using powershell and your solution works for me. Thanks a lot!

The working command:

az aks update --resource-group my-resource-group --name my-aks --api-server-authorized-ip-ranges=""

@fengzhou-msft thanks for the detailed guides.

Hello Team,

The above command worked fine .Thanks team.

Was this page helpful?
0 / 5 - 0 ratings