About VMSS with Public IP with "Routing preference > Internet"

realquest 20 Reputation points
2023-05-26T17:32:46.8166667+00:00

for example,

i have 10 VM though VMSS, and i want public ip with "Routing preference > Internet",

is there only way to create Public IP one by one? (Azure portal -> IP addresses -> Add -> connect each VM)

or how to make 10 "Routing preference > Internet" Public IP at once?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,120 questions
Azure VMware Solution
Azure VMware Solution
An Azure service that runs native VMware workloads on Azure.
362 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,551 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 20,222 Reputation points Microsoft Employee
    2023-05-31T03:51:08.0133333+00:00

    @realquest Thanks for posting your query on Microsoft Q&A.

    You can create IP addresses with routing preference - Internet using the CLI with this command:

    az network public-ip create \
        --resource-group TutorVMRoutePref-rg \
        --name myPublicIP \
        --version IPv4 \
        --ip-tags 'RoutingPreference=Internet' \
        --sku Standard \
        --zone 1 2 3
    

    You can programmatically achieve your goal using this command, by writing a script for your scenario.

    Reference doc: https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/configure-routing-preference-virtual-machine-cli#create-a-public-ip-address

    Let me know if that helps.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.