使用Azure PowerShell,設定Virtual Machine Endpoint
我們可以通過Windows Azure Management Portal,開啟Virtual Machine的Endpoint,借用我之前博文的圖片:
但是如果我們需要開啟非常多的Endpoint, 就需要手動一個一個地設定,非常的繁瑣。
其實我們可以通過Windows Azure Powershell,來大量設定Virtual Machine的Endpoint。
1.假設已經建立完畢一台Vitual Machine,名稱為LeiSQLVM
2.我們使用管理員身份運行,運行Windows Azure Management Portal
3.如果你是第一次運行Azure PowerShell。我們要在本地建立認證檔案。以便本機電腦和Azure建立可靠的安全連線。
請參考筆者之前的博文:[New Portal]Windows Azure Virtual Machine (16) 使用Azure PowerShell建立Azure Virtual Machine
查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/Servers/cloud-computing/
4.上傳認證完畢後,假設我們需要為LeiSQLVM這台虛擬機器設定TCP Endpoint
Endpoint Name為TCP80
Public Port為80
Public Port為80
5.我們回到Azure Powershell,繼續輸入以下命令
Get-AzureVM –ServiceName ‘LeiSQLVM’ –Name ‘LeiSQLVM’ | add-AzureEndpoint –Name ‘TCP80’ –Protocol ‘TCP’ –Publicport 80 –LocolPort 80 | Update-AzureVM
運行完畢後,結果如下
6.在Management Portal裡查到設定結果:
7.筆者只是簡單介紹了下單台VM的Endpoint設定,如果要多台 VM設定Endpoint,請參考MSDN文章
http://msdn.microsoft.com/en-us/library/windowsazure/jj152886.aspx