iT邦幫忙

1

Microsoft Azure Pass 學習日誌 Day 2

Chap.I Compute Services 計算服務

https://ithelp.ithome.com.tw/upload/images/20220117/201385271nKLGdxUdc.png

Part 1. Virtual Machine 虛擬主機

*虛擬主機與虛擬容器的差別
https://ithelp.ithome.com.tw/upload/images/20210630/20138527SPaWMAf2EQ.png

1. 建立你的虛擬主機

所有服務 → 計算 → 虛擬主機

基本
資源群組:myRGVM(隨便取)
虛擬機器名稱:myVM(隨便取)
影像:Windows Server 2019 Datacenter - Gen1
大小:(選可用)
帳戶:(自創)
密碼:(自創)
選取輸入連接:把 "HTTP (80)" 打勾
https://ithelp.ithome.com.tw/upload/images/20220117/20138527lCtGaY2oXD.png
網路
選取輸入連接:把 "HTTP (80)" 打勾

管理
開機診斷:停用
https://ithelp.ithome.com.tw/upload/images/20220117/20138527tW4O4RT61u.png

建立

2. 下載RDP檔案 (遠端桌面連線)

前往資源 → 連接 → RDP
https://ithelp.ithome.com.tw/upload/images/20220117/20138527o8STv8hKTc.png

下載RDP檔案

3. 遠端連線

點擊下載完成的檔案 → 輸入帳號密碼 (為避免帳號找不到,可於前加 ".\" )
https://ithelp.ithome.com.tw/upload/images/20220117/201385274bxIUvUXdM.png

4. 建立/修改網頁伺服器

開始 → Windows PowerShell
https://ithelp.ithome.com.tw/upload/images/20220117/20138527r4kFUbVvBQ.png

輸入:"Install-WindowsFeature -name Web-Server -IncludeManagementTools"
接著進入路徑:"C:\inetpub\wwwroot"
iisstart 右鍵 → 以筆記本方式開啟
https://ithelp.ithome.com.tw/upload/images/20220117/20138527k9cI28JK3Z.png

在 body 下方鍵入:<h1> GJun Here </h1>
https://ithelp.ithome.com.tw/upload/images/20220117/20138527AhkUF9JKwT.png

5. 開啟網頁伺服器

虛擬機器 → myVM → 概觀
找到「公用IP位置」:52.191.28.254
https://ithelp.ithome.com.tw/upload/images/20220117/20138527G9uEndbfP6.png

開啟瀏覽器,鍵入網址:http://52.191.28.254
可看到我們修改的 GJun Here 出現在左上角
https://ithelp.ithome.com.tw/upload/images/20220117/20138527c7Rfi59fw0.png

6. 刪除資源群組

為避免不必要花費,故須刪除資源群組
首頁 → 資源群組 → myRGVM → 刪除資源群組

Part 2. Deploy a simple VM

1. 建立你的簡易虛擬機

進入官方網站:https://azure.microsoft.com/zh-tw/resources/templates/?azure-portal=true
點選:Deploy a simple Windows VM
點選:部署到 Azure
https://ithelp.ithome.com.tw/upload/images/20210704/201385273inm83Qh9X.png

基本
資源群組:myRGTemp (隨便取)
區域:美國東部
帳戶:(自創)
密碼:(自創)
Dns Label Prefix:myVMTemp-790502
OS-Version:2019-Datecenter
https://ithelp.ithome.com.tw/upload/images/20210705/20138527XtOgTPIUau.png

檢閱 + 建立

2. 下載RDP檔案 (遠端桌面連線)

虛擬機器 → myVMTemp-790502 → 連接 → RDP

3. 虛擬機效能監控

資源群組 → myRGTemp → simple-vm → 概觀 → 監視
https://ithelp.ithome.com.tw/upload/images/20210705/20138527nfckAIlfhP.png

4. 刪除群組

Part 3. Deploy VM by Cloud Shell

3-1. By Power Shell

點選右上角 Cloud Shell → Power Shell
https://ithelp.ithome.com.tw/upload/images/20210705/20138527sQTO0gaQo5.png
進入 Terminal

1. 新建一個 Resource Group:

New-AzResourceGroup -Name myRGPS -Location EastUS

https://ithelp.ithome.com.tw/upload/images/20210705/201385271R8u2NAVhk.png

2. 查看所有 Resource Group

Get-AzResourceGroup | Format-table

https://ithelp.ithome.com.tw/upload/images/20210705/20138527GIb8ig5HvU.png

3. 新建一個 VM

New-AzVM `
-ResourceGroupName "myRGPS" `
-Name "myVMPS" `
-Location "East US" `
-VirtualNetworkName "myVNetPS" `
-SubnetName "mySubNPS" `
-SecurityGroupName "mySGNPS" `
-PublicIpAddressName "myPublicIpPS"

>> User: s790502ss
>> Password: ************

https://ithelp.ithome.com.tw/upload/images/20210705/20138527QzKvhf4sJC.png

4. 查看 VM 狀態

Get-AzVM -name myVMPS -status | Format-Table -autosize

https://ithelp.ithome.com.tw/upload/images/20210705/20138527a4sdDngD2x.png

5. 停止 VM

Stop-AzVM -ResourceGroupName myRGPS -Name myVMPS
# 選擇 "Y"

https://ithelp.ithome.com.tw/upload/images/20210705/201385276Ny7MnVVmI.png

6. 再次查看 VM 狀態

Get-AzVM -name myVMPS -status | Format-Table -autosize

https://ithelp.ithome.com.tw/upload/images/20210705/20138527xygbzz2wqK.png

7. 刪除群組

3-2. By Bash

0. 點選左上角 Power Shell → Bash

https://ithelp.ithome.com.tw/upload/images/20210705/20138527amy6u0UydJ.png

1. 新建一個 Resource Group:

az group create --name myRGCLI --location EastUS

https://ithelp.ithome.com.tw/upload/images/20210705/20138527eSV7m434KS.png

2. 查看所有 Resource Group

az group list --output table

https://ithelp.ithome.com.tw/upload/images/20210705/2013852719VrY4C1Mr.png

3. 新建一個 VM

az vm create \
--name myVMCLI \
--resource-group myRGCLI \
--image UbuntuLTS \
--location EastUS \
--admin-username s790502ss \   # 隨便取
--admin-password S229100608ss  # 隨便取

https://ithelp.ithome.com.tw/upload/images/20210705/20138527oJpKQE5F81.png

4. 查看 VM 狀態

az vm show --resource-group myRGCLI --name myVMCLI --show-details --output table

https://ithelp.ithome.com.tw/upload/images/20210705/201385271Cvb0pwYjm.png

5. 停止 VM

az vm stop --resource-group myRGCLI --name myVMCLI

https://ithelp.ithome.com.tw/upload/images/20210705/20138527GFgciMot5C.png

6. 再次查看 VM 狀態

az vm show --resource-group myRGCLI --name myVMCLI --show-details --output table

https://ithelp.ithome.com.tw/upload/images/20210705/20138527ouswR3JzOR.png

7. 刪除群組

Part 4. APP Services 應用程式服務

1. 建立你的應用程式

所有服務 → 計算 → 應用程式服務

基本
資源群組:myRGWebAPP (隨便取)
名稱:webapp-790502 (隨便取)
發佈:Docker 容器
作業系統:Linux
地區:East US
https://ithelp.ithome.com.tw/upload/images/20210704/20138527MIQoH7xd6M.png
Docker
選項:單一容器
映像來源:Docker Hub
存取類型:公用
映像及標籤:microsoft/aci-helloworld
https://ithelp.ithome.com.tw/upload/images/20210704/20138527yXh2VVJqal.png

2. 開啟網頁伺服器

應用程式服務 → webapp-790502
複製 URL:https://webapp-790502.azurewebsites.net
https://ithelp.ithome.com.tw/upload/images/20210704/20138527tIi8XHA8HQ.png
開啟網頁,鍵入:https://webapp-790502.azurewebsites.net
https://ithelp.ithome.com.tw/upload/images/20210704/20138527d3avXTnqfE.png

3. 刪除群組

Part 5. Functions App 函數應用程式

所有服務 → 計算 → 函數應用程式

1. 建立你的函數應用程式

所有服務 → Functions App 函數應用程式
資源群組:myRGFunction (隨便取)
函數應用程式名稱:function-790502 (隨便取)
執行階段堆疊:.NET
地區:East US
https://ithelp.ithome.com.tw/upload/images/20210704/20138527WtbDX7tyb7.png

2. 新增函式

先選 HTTP trigger 試驗
https://ithelp.ithome.com.tw/upload/images/20210704/20138527oaSNI5to9o.png

3. 使用函式

https://ithelp.ithome.com.tw/upload/images/20210704/20138527Jm3Mbtd6QJ.png
在網頁區塊打上:「複製網址」+「&name=Peter」
https://ithelp.ithome.com.tw/upload/images/20210704/201385270AF4aoPnXD.png
另外還有多種函式可供使用
https://ithelp.ithome.com.tw/upload/images/20210704/20138527FVj8SlhFTQ.png

4. 刪除群組


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言