Windows Azure PowerShell之管理虛擬機器

來源:互聯網
上載者:User

標籤:windows   虛擬機器   blank   target   定向   

我們可以用Windows Azure PowerShell來管理Windows Azure虛擬機器。接下來我們來看下如何使用Windows Azure PowerShell建立和刪除虛擬機器。

1.擷取虛擬機器鏡像。Get-AzureVMImage 這個命令可以返回虛擬機器鏡像列表,由於現在Azure當中的鏡像非常多,運行該命令時最好將通過管道重新導向到txt檔案中,以便查看。另外因我們後面用New-AzureQuickVM命令建立虛擬機器時只需要知道鏡像的名稱,因此在執行Get-AzureVMImage 加上 管道篩選出ImageName即可。如

650) this.width=650;" title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/34/wKiom1hk7LaDuQuaAAA8lawFuOc295.png" "644" height="65" />

2.擷取Azure地區。Get-AzureLocation,同樣我們只需要知道displayname,通過管道篩選displayname即可。

650) this.width=650;" title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/34/wKiom1hk7LfgTnGIAACJcPlAi8A341.png" "644" height="197" />

3.New-AzureQuickVM建立虛擬機器。

在PowerShell中依次執行以下命令

PS C:\Users\huangcj> $image = "55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-Datacenter-20161214-zh.cn-127GB.vhd
"
PS C:\Users\huangcj> $location = Get-AzureLocation
PS C:\Users\huangcj> $svcname = "hcjtest"
PS C:\Users\huangcj> $admpass = "abc;123456"
PS C:\Users\huangcj> New-AzureQuickVM -Windows -InstanceSize "Large" -ServiceName $svcname -Name "hcjt5" -ImageName $ima
ge -Password $admpass -AdminUsername "huangcj" -Location $location[0].name

650) this.width=650;" title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/31/wKioL1hk7LjD2lseAAGZTPpcbSY641.png" "644" height="166" />

$location[0].name 為China East 即上海資料中心,$location[1].name為China North 即北京資料中心。

執行完後,我們到Azure Portal中可以看到建立好的虛擬機器.

650) this.width=650;" title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8C/35/wKiom1hk7LnTT0waAABA2gibDac412.png" "644" height="111" />

4.刪除虛擬機器 Remove-AzureVM

刪除命名比較簡單,見

650) this.width=650;" title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/31/wKioL1hk7LnTwznWAAA2xE3msVs017.png" "644" height="133" />

 

650) this.width=650;" title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/31/wKioL1hk7LqD6hyZAACIEL84Rn8856.png" "644" height="138" />

以上的命令並沒有刪除硬碟vhd檔案,如果要刪除則在後面加上參數 –DeleteVHD

Windows Azure PowerShell之管理虛擬機器

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.