@Learner , Thank you for your question.
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 az vmss create command.
To create a scale set using an Azure template, make sure the API version of the Microsoft.Compute/virtualMachineScaleSets
resource is at least 2017-03-30, and add a publicIpAddressConfiguration
JSON property to the scale set ipConfigurations
section. For example:
"publicIpAddressConfiguration": {
"name": "pub1",
"properties": {
"idleTimeoutInMinutes": 15
}
}
Example template: vmss-public-ip-linux
For more information please check out this section.
----
Hope this helps.
Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.