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
2020-12-02T06:36:58.093+00:00

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

1 answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 47,011 Reputation points Microsoft Employee
    2020-12-02T10:27:21.56+00:00

    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:
    https://learn.microsoft.com/en-us/rest/api/virtualnetwork/securityrules/createorupdate

    To get the network interface ip configuration of a VM:
    https://learn.microsoft.com/en-us/rest/api/virtualnetwork/networkinterfaceipconfigurations/get

    To get the public IP address of a VM in a specified resource group:
    https://learn.microsoft.com/en-us/rest/api/virtualnetwork/publicipaddresses/get

    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.