I have a AKS cluster and I want to get the public IP of the virtual machine scale set associated with the cluster's agentpool. I found this documentation page and tried the following API call:
GET https://management.azure.com/subscriptions/{your sub ID}/resourceGroups/{RG name}/providers/Microsoft.Compute/virtualMachineScaleSets/{scale set name}/publicipaddresses?api-version=2017-03-30
but i get this response: {"value":[]}
For your issue, you need to take care of the message that how does the VMSS create:
To create a scale set that assigns a public IP address to each virtual machine with the CLI, add the --public-ip-per-vm parameter to the vmss create command.
Only in this way you can get the public IP addresses via the REST API:
GET https://management.azure.com/subscriptions/{your sub ID}/resourceGroups/{RG name}/providers/Microsoft.Compute/virtualMachineScaleSets/{scale set name}/publicipaddresses?api-version=2017-03-30
But when you create the AKS cluster and enable the VMSS as the agent pool, the VMSS always behind in a Load Balancer so that it's publicIpAddressConfiguration
property is null
and give your response as empty.