LoginSignup
0
0

More than 3 years have passed since last update.

Windows Admin Center を Azure CLI でインストールしてみた

Posted at

背景と目的

Azure ポータル上で Windows Admin Center がプレビューで使えるようになったのですが、Azure CLI でのインストール方法が不明だったので実際にやってみました。

Announcing public preview of Windows Admin Center in the Azure portal

前提条件

Azure CLI のバージョンを確認します。

zsh
az version                            

{
  "azure-cli": "2.21.0",
  "azure-cli-core": "2.21.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {}
}

実施内容

zsh
# パラメーターを設定
azRG=myResourceGroup
azRegion=japaneast
azVMName=myVM
azUserName=azureuser
azPassword=$(openssl rand -base64 16)
echo $azPassword

# リソースグループを作成
az group create \
  --name $azRG \
  --location $azRegion

# VM を作成( NSG は後ほど設定)
az vm create \
  --resource-group $azRG \
  --name $azVMName \
  --image Win2019Datacenter \
  --admin-username $azUserName \
  --admin-password $azPassword \
  --size Standard_DS1_v2 \
  --nsg-rule NONE \
  --storage-sku Standard_LRS

# VM エージェントが動作しているか確認
az vm run-command invoke \
  --command-id IPConfig \
  --resource-group $azRG \
  --name $azVMName

# AdminCenter をインストール
az vm extension set \
  --resource-group $azRG \
  --vm-name $azVMName \
  --name AdminCenter \
  --publisher Microsoft.AdminCenter \
  --settings '{"port":"6516", "cspFrameAncestors":["https://portal.azure.com","https://*.hosting.portal.azure.net","https://localhost:1340"], "corsOrigins":["https://portal.azure.com","https://waconazure.com"]}'

# 自分自身の IP アドレスを変数にセット
myIP=$(curl -s inet-ip.info)

# NSG 名を変数にセット
azNSG=$(az network nsg list \
  --resource-group $azRG \
  --query "[].name" \
  --out tsv)

# NSG に自分自身の IP アドレスからポート 6516 への接続を許可するルールを追加
az network nsg rule create \
    --resource-group $azRG \
    --name WAC \
    --nsg-name $azNSG \
    --priority 1000 \
    --source-address-prefixes $myIP/32 \
    --destination-port-ranges 6516 \
    --access Allow \
    --protocol Tcp

実施結果

無事 Azure ポータルから Windows Admin Center を使うことが出来ました。

こちらのスクリーンショットは、リモートデスクトップの画面です。

admin-center.png

参考

標準ポートは 6516 ですが、443 でインストールしても Windows Admin Center を使うことが出来ました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0