How to add public IP to APIM via CLI?

Shuchita Tripathi 6 Reputation points
2021-07-06T17:52:18.007+00:00

I am trying to add separately managed public IP to Azure APIM (external) using CLI. Command is not giving any error but IP is not getting attached.
Command:
az resource update --ids "<apim-id>" --set properties.publicIPAddresses="20.x.x.x"

Output:
112177-image.png

For reference, this is what I am trying to do:
112196-image.png

How can I add a separately managed public IP to APIM using automation? (preferably CLI, however powershell will also help). Separately managed IP refers to IP created using create public IP command, and then attaching that to APIM.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,959 questions
{count} vote

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,016 Reputation points
    2021-07-08T02:17:53.373+00:00

    @Shuchita Tripathi Currently, the Azure portal uses API version 2021-01-01 preview when creating or updating an API Management instance. You can specify this API version using an Azure Resource Manager template or the API Management REST API. The Azure CLI and Azure PowerShell currently support API version 2020-12-01.

    When I test with AZ CLI version is 2.25.0/2.26.0 then I observe the Bad Request as it is expected as the Azure CLI doesn't support this functionality yet. The same is documented here.
    ERROR: Operation returned an invalid status 'Bad Request'

    You should observe the same behavior. You can try running the command with --debug to get more details on the request and error message.

    For any CLI feature/feedback/issue you can always post your query here.