gpt4 book ai didi

azure - 使用 powershell 在 Azure 中创建没有公共(public) IP 的 VM

转载 作者:行者123 更新时间:2023-12-03 04:17:03 25 4
gpt4 key购买 nike

我正在使用 powershell 从镜像在 Azure 上创建 VM。

这是我正在使用的脚本。

$UserName = "username"
$Password = ConvertTo-SecureString "password@123" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential($UserName, $Password)
New-AzureRmVm `
-ResourceGroupName "RSG" `
-Name "VMName" `
-ImageName "ImageName" `
-Location "West US" `
-VirtualNetworkName "VNName" `
-SubnetName "default" `
-Credential $psCred
-PublicIpAddressName "None" `
-OpenPorts 3389

但是,当我进入 Azure 门户并看到时,默认情况下会分配一些公共(public) IP。我也尝试过不提供 PublicIpAddressName 属性,假设它不会分配任何 IP,但它仍然在分配。

我希望公共(public) IP 为无。任何人都可以帮助我实现这一目标。谢谢!

最佳答案

目前这个问题在官方azure-powershell github上仍处于Open状态。您可以引用here 。如果您仍然想绕过此问题,可以尝试使用 New-AzureReservedIP 或在部署命令后尝试自行删除公共(public) IP Remove-AzureRmPublicIpAddress

注意:我还没有测试过。只是一个想法。

引用:Docs

关于azure - 使用 powershell 在 Azure 中创建没有公共(public) IP 的 VM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52032407/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com