首页 > 代码库 > 使用Powershell在Microsoft Azure中创建Virtual Machine
使用Powershell在Microsoft Azure中创建Virtual Machine
获取虚拟机镜像
PS C:\WINDOWS\system32> Get-AzureVMImage
仅获得虚拟机名
PS C:\WINDOWS\system32> (Get-AzureVMImage).ImageName0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20131018-enus0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20131018-zhcn0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140115-enus0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140115-zhcn0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140213-enus0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140213-zhcn0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140306-enus0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140306-zhcn0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140327-enus0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140327-zhcn0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140618-enus0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140618-zhcn0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140715-enus0c5c79005aae478e8883bf950a861ce0__Windows-Server-2012-Essentials-20140715-zhcn250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-SAP-CAL-v103250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-SAP-CAL-v108250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-v203250d269906be4694a10aee49a3385f2d__SUSE-Linux-Enterprise-Server-11-SP3-v206250d269906be4694a10aee49a3385f2d__openSUSE-13.1-v102250d269906be4694a10aee49a3385f2d__openSUSE-13.1-v10555bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201408.01-en.us-127GB.vhd55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201408.01-zh.cn-127GB.vhd55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201409.01-en.us-127GB.vhd55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201409.01-zh.cn-127GB.vhd55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201410.01-en.us-127GB.vhd55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201410.01-zh.cn-127GB.vhd55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201408.01-en.us-127GB.vhd55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201408.01-zh.cn-127GB.vhd55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201409.01-en.us-127GB.vhd55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201409.01-zh.cn-127GB.vhd55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-201410.01-en.us-127GB.vhd55bc2b193643443bb879a78bda516fc8__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:\WINDOWS\system32> New-AzureVMConfig -Name ‘WinSerEss-1‘ -InstanceSize ‘ExtraSmall‘ -ImageName (Get-AzureVMImage)[12].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/
使用Powershell在Microsoft Azure中创建Virtual Machine