如何在出站 Internet 访问受限时 运行 VM 上的 Azure Powershell cmdlet

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

我正在使用驻留在 VM 中的 Powershell 脚本来检索订阅中的资源列表。目前我在 VM 的 NSG 上启用了出站互联网。但我想限制以后的出站互联网访问。

有没有办法在 Internet 访问被拒绝时 运行 powershell 脚本?

Run Command 功能可以 运行 通过使用 VM 代理在您的虚拟机上远程编写脚本。要正常运行,运行 命令需要连接(端口 443)到 Azure public IP 地址。如果要阻止虚拟机上的流量,您可以使用 服务标签 通过使用 AzureCloud 标签允许流量到 Azure public IP 地址。

没有名为 azurecloud 的服务标签有白名单 azure datacenter IP。也在寻找创建自定义服务的选项,这现在是不可能的