Need to Enable ports 80 and 443 along with inbound rules using Azure REST API so as to run the IPADdress of the Virtual Machine

ANIRUDH TPVS 1 Reputation point

I am very new to azure and this is my first time working with azure.

I am actually trying to develop a script wherein I have to return the IPAddress of the virtual machine(created using a script via Azure REST API) as the output of the script. Right now I am unable to run the IPAddress returned as output by the script on the browser since I have to enable the ports 80 and 443 along with the inbound rules required for the Virtual machine in the particular ipAddress to run. For enabling the ports, I must do it using a script via the REST API. In short, all of the process above must be done using a REST API. I need some technical guidance in sorting out this problem.

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,206 questions
{count} votes

1 answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 48,016 Reputation points Microsoft Employee

    Hello @ANIRUDH TPVS ,

    You can find the links to requested REST APIs below:

    To create or update a security rule in the specified network security group. which can be used to enable ports 80 and 443 along with inbound rules:

    To get the network interface ip configuration of a VM:

    To get the public IP address of a VM in a specified resource group:

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.