Recently I’ve migrated a bunch of Virtual Box Virtual Machines to Azure as detailed here. These VM’s are in Resource Groups with a Network Security Group associated that restricts access to them for RDP based on a source TCPIP address. All good practice. However from a usability perspective, when I want to use these VM’s, I’m not always in the same location, and rarely on a connection with a static IP address.
This post details a simple little script that;
- Has a couple of variables associated with a Resource Group, Network Security Group, Virtual Machine Name and an RDP Configuration File associated with the VM
- Gets the public IP Address of the machine I’m running the script from
- Prompts for Authentication to Azure, and retrieves the NSG associated with the Resource Group
- Compares the Source IP Address in the ‘RDP’ Inbound Rule to my current IP Address.