3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Azure 仮想マシン Ubuntu Server 20.04 LTSの作成でハマる

Last updated at Posted at 2023-01-19

New-AzVm

Microsoft LearnでAzureを学習しています。
演習 - Azure PowerShell でスクリプトを使用して Azure リソースを作成する - Training | Microsoft Learn
でハマりました。

New-AzVm -ResourceGroupName *****-********-****-****-****-************ -Name "testvm-eus-01" -Credential (Get-Credential) -Location "japaneast" -Image UbuntuLTS -OpenPorts 22 -PublicIpAddressName "testvm-01"
New-AzVM: The platform image 'Canonical:UbuntuServer:20.04-LTS:latest' is not available.
Verify that all fields in the storage profile are correct.
For more details about storage profile information, please refer to https://aka.ms/storageprofile

-Image UbuntuLTSCanonical:UbuntuServer:20.04-LTS:latestを指すのがわかるけど、それが使えないってどういうこと?

ポータルで見てみる

MarketPlaceにはそれらしき仮想マシンが存在
image.png

色々調べて

ARMの情報の通りにVMのソースイメージの指定のしかたを厳密にすれば特定のUbuntuのイメージを特定できることはわかりましたが、
初心者なのでまだあまりゴリゴリ書きたくない...

どうも、CanonicalによるLTS版の扱いに起因しているようです。
Can't find ubuntu 20.04 with azure cli · Issue #13320 · Azure/azure-cli · GitHub

解決策

上記Issueでの投稿を参考に、パラメータを変えて解消
ポータルから作成した時に気づいたけど、-Name-PublicIpAddressNameも合わせておかないとうまくいかないようです。

New-AzVm -ResourceGroupName *****-********-****-****-****-************ -Name "testvm-jeast-01" -Credential (Get-Credential) -Location "japaneast" -Image "Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest" -OpenPorts 22 -PublicIpAddressName "testvm-01"

image.png

3
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?