使用Powershell在Microsoft Azure中创建Virtual Machine

获取虚拟机镜像

PS C:WINDOWSsystem32> Get-AzureVMImage

仅获得虚拟机名

PS C:WINDOWSsystem32> (Get-AzureVMImage).ImageName
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20131018-enus
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20131018-zhcn
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140115-enus
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140115-zhcn
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140213-enus
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140213-zhcn
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140306-enus
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140306-zhcn
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140327-enus
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140327-zhcn
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140618-enus
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140618-zhcn
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140715-enus
0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140715-zhcn
250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-SAP-CAL-v103
250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-SAP-CAL-v108
250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-v203
250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-v206
250d269906be4694a10aee49a3385f2d__openSUSE-13.1-v102
250d269906be4694a10aee49a3385f2d__openSUSE-13.1-v105
55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201408.01-en.us-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201408.01-zh.cn-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201409.01-en.us-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201409.01-zh.cn-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201410.01-en.us-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201410.01-zh.cn-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201408.01-en.us-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201408.01-zh.cn-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201409.01-en.us-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201409.01-zh.cn-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201410.01-en.us-127GB.vhd
55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201410.01-zh.cn-127GB.vhd
。。。。

需要0.8.7 版本为 the Microsoft Azure PowerShell module,如何安装请参考http://www.cnblogs.com/SignalTips/p/4106248.html

使用 Windows PowerShell 管理映像

http://msdn.microsoft.com/zh-cn/library/azure/dn790330.aspx

需要的事先绑定的存储账号,参考

Microsoft AzureStorageAccount for Powershell

密码请自行符合复杂程度

创建单台虚拟机

PS C:WINDOWSsystem32> New-AzureVMConfig -Name 'WinSerEss-1' -InstanceSize 'ExtraSmall' -ImageName (Get-AzureVMImage)[1
2].ImageName ` | Add-AzureProvisioningConfig -Windows -AdminUsername 'Anderson' -Password '' ` | New-AzureVM -
ServiceName 'AndersonService' -Location 'China East'

OperationDescription                    OperationId                             OperationStatus
--------------------                    -----------                             ---------------
New-AzureVM                             57c11fda-7545-4d0c-b3e2-67d461f23d3f    Succeeded

PowerShell中看到Create Succeeded,其实虚拟机没有完全创建,可以去Portal上查看

New-AzureVMConfig

http://msdn.microsoft.com/en-us/library/azure/dn495159.aspx

Azure 虚拟机常见问题 更新时间: 2014年9月

http://msdn.microsoft.com/zh-cn/library/azure/dn683781.aspx

How to Configure An Availability Set for Virtual Machines

http://azure.microsoft.com/zh-cn/documentation/articles/virtual-machines-how-to-configure-availability/

Manage the availability of virtual machines Understand planned versus unplanned maintenance

http://azure.microsoft.com/zh-cn/documentation/articles/virtual-machines-manage-availability/

原文地址:https://www.cnblogs.com/SignalTips/p/4118880.html