适用于:✔️ Linux VM ✔️ Windows VM ✔️ 灵活规模集 ✔️ 统一规模集 可以使用 Azure PowerShell 查看何时安排 VM 进行维护。 使用 -status 参数时可通过 Get-AzVM cmdlet 获得计划内维护信息。 仅当有计划内维护时,才会返回维护信息。 如果未计划任何影响 VM 的维护,该 cmdlet 不返回任何...
$sub_id="<Subscription ID>"$res_group="<Resource group>"$identityName="aibIdentity"# Use a web request to download the sample JSON description$sample_uri="https://raw.githubusercontent.com/azure/azvmimagebuilder/master/solutions/12_Creating_AIB_Security_Roles/aibRoleNetworking.json"$role_defin...
Get-AzureVM $vmCount = $vms.Count # 提取变量Value for($i=0; $i -lt $vmCount; $i++) { $vm = $vms[$i]; $sheet.cells.item($x,1) = $vm.name $sheet.cells.item($x,2) = "虚拟机(经典)" $sheet.cells.item($x,3) = $vm.status $sheet.cells.item($x,4) = $vm.Service...
此脚本使用自定义映像在 China North 位置中名为 myResourceGroupFromImage 的新资源组中创建名为 myVMfromImage 的 VM。 PowerShell复制 $cred=Get-Credential-Message"Enter a username and password for the virtual machine."New-AzureRmResourceGroup-NamemyResourceGroupFromImage-LocationChinaEast$subnetConfig=Ne...
如果您遇到錯誤,請檢閱針對 Azure VM Image Builder 失敗進行疑難排解。 建立VM 將VM 登入認證儲存在變數中。 必須使用複雜密碼。 Azure PowerShell $Cred=Get-Credential 使用您建立的映像建立 VM。 Azure PowerShell $ArtifactId= (Get-AzImageBuilderTemplateRunOutput-ImageTemplateName$imageTemplateName-ResourceGrou...
我们可以使用Get-AzureRmVM命令获取VMName和ResourceGroupName。要想让过滤操作更为容易,可以使用如下命令: PS C:\> Get-AzureRmVM -status | where {$_.PowerState -EQ "VM running"} | select ResourceGroupName,Name ResourceGroupName Name --- --- TESTRESOURCES Remote-Test...
要使用 PowerShell 命令创建新的 Azure 虚拟机 (VM),可将本地安装的 Windows PowerShell 与 Az 模块配合使用,也可以使用 Azure 门户中提供的 Cloud Shell 环境。 如果选择使用本地安装的 PowerShell,建议使用 Windows PowerShell 7.1。 还应安装 Az 模块,以获得与 Azure 相关...
ResourceGroupName – VM资源组 VMName – VM的名称 CommandId – 要在Azure中运行的存储类型的命令。 “RunPowerShellScript”允许我们上传和运行PowerShell脚本。 ScriptPath – 你要运行的PowerShell PS1文件的路径。 你可以使用Get-AzureRmVM命令获取VMName和ResourceGroupName。
2、VMName:虚拟机名称。 3、CommandId:要在Azure中运行的命令的存储类型。 其中,“RunPowerShellScript”允许我们上传和运行PowerShell脚本,我们在这里只使用CommandId。 4、ScriptPath:想要运行的PowerShell PS1文件的路径。 我们可以使用Get-AzureRmVM命令获取VMName和ResourceGroupName。要想让过滤操作更为容易,可以...
此脚本使用自定义映像在 China North 位置中名为 myResourceGroupFromImage 的新资源组中创建名为 myVMfromImage 的 VM。 PowerShell复制 $cred = Get-Credential -Message "Enter a username and password for the virtual machine." New-AzureRmResourceGroup -Name myResourceGroupFromImage -Location ChinaEast ...