How to run a Azure Powershell cmdlets on a VM when outbound Internet access is restricted

155 views Asked by At

I am using Powershell script that resides in a VM to retrieve the list of resources in a subscription. Currently I have the outbound internet enabled on the NSG of the VM. But I would like to restrict the outbound internet access in future.

Is there a way to run the powershell script when internet access is denied ?

2

There are 2 answers

0
Nancy On BEST ANSWER

The Run Command feature can run scripts on your virtual machines remotely by using the VM agent. To function correctly, Run Command requires connectivity (port 443) to Azure public IP addresses. If you're blocking traffic on the virtual machine, you can use service tags to allow traffic to Azure public IP addresses by using the AzureCloud tag.

1
suresh8771 On

There is no service tag called azurecloud have whitelist azure datacenter IP. Also looking for option to create custom service which is not possible now