リソースグループ作成
1 |
az group create --name myResourceGroupMonitor --location eastus |
VM作成
1 2 3 4 5 6 |
az vm create \ --resource-group myResourceGroupMonitor \ --name myVM \ --image UbuntuLTS \ --admin-username azureuser \ --generate-ssh-keys |
ストレージアカウント作成
1 2 3 4 5 6 7 |
storageacct=mydiagdata$RANDOM az storage account create \ --resource-group myResourceGroupMonitor \ --name $storageacct \ --sku Standard_LRS \ --location eastus |
1 |
bloburi=$(az storage account show --resource-group myResourceGroupMonitor --name $storageacct --query 'primaryEndpoints.blob' -o tsv) |
ブート診断の有効化
1 2 3 4 |
az vm boot-diagnostics enable \ --resource-group myResourceGroupMonitor \ --name myVM \ --storage $bloburi |
VMの割り当てを解除
1 |
az vm deallocate --resource-group myResourceGroupMonitor --name myVM |
VM起動
1 |
az vm start --resource-group myResourceGroupMonitor --name myVM |
ブート診断を見る
1 |
az vm boot-diagnostics get-boot-log --resource-group myResourceGroupMonitor --name myVM |
このように出る
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
[ OK ] Created slice Slice for walinuxagent extensions. 2019/12/01 05:50:36.809785 INFO ExtHandler Created slice for walinuxagent extensions system-walinuxagent.extensions.slice 2019/12/01 05:50:36.820258 INFO ExtHandler Set block dev timeout: sdb with timeout: 300 [ OK ] Started LXD - container startup/shutdown. 2019/12/01 05:50:36.829196 INFO ExtHandler Wire server endpoint:168.63.129.16 2019/12/01 05:50:36.852429 INFO ExtHandler Set block dev timeout: sda with timeout: 300 [ OK ] Started Snappy daemon. Starting Wait until snapd is fully seeded... [ OK ] Started Wait until snapd is fully seeded. Starting Apply the settings specified in cloud-config... 2019/12/01 05:50:36.973870 INFO ExtHandler Wire server endpoint:168.63.129.16 2019/12/01 05:50:37.060237 INFO ExtHandler Wire server endpoint:168.63.129.16 2019/12/01 05:50:37.072305 INFO ExtHandler ProcessGoalState completed [incarnation 1; 98 ms] [ 25.083199] cloud-init[1443]: Cloud-init v. 19.2-36-g059d049c-0ubuntu2~18.04.1 running 'modules:config' at Sun, 01 Dec 2019 05:50:37 +0000. Up 24.89 seconds. [ OK ] Started Apply the settings specified in cloud-config. Starting Write warning to Azure ephemeral disk... [ OK ] Started Write warning to Azure ephemeral disk. [ OK ] Reached target Multi-User System. Starting Execute cloud user/final scripts... [ OK ] Reached target Graphical Interface. Starting Update UTMP about System Runlevel Changes... [ OK ] Started Update UTMP about System Runlevel Changes. [ 25.806174] cloud-init[1517]: Cloud-init v. 19.2-36-g059d049c-0ubuntu2~18.04.1 running 'modules:final' at Sun, 01 Dec 2019 05:50:38 +0000. Up 25.67 seconds. [ 25.827758] cloud-init[1517]: Cloud-init v. 19.2-36-g059d049c-0ubuntu2~18.04.1 finished at Sun, 01 Dec 2019 05:50:38 +0000. Datasource DataSourceAzure [seed=/var/lib/waagent]. Up 25.79 seconds [ OK ] Started Execute cloud user/final scripts. [ OK ] Reached target Cloud-init target. Ubuntu 18.04.3 LTS myVM ttyS0 |
AzurePortalから
画面スクショも見れる(ブート失敗したときの状態をみれるのかな)