4
4

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 5 years have passed since last update.

Azure PowerShell ことはじめ

Last updated at Posted at 2016-02-23

Azure 環境でちょっとした操作を調べるとすぐに行き着くのが PowerShell。
ここでは、Azure PowerShell のインストールと初期設定を説明します。

PowerShell のインストール

WebPI からインストールする方法と PowerShell ギャラリーからインストールする方法があるのですが、どうも前者の WebPI はうまくいかなかったので、ここでは後者の PowerShell ギャラリーからのインストールをします。

  1. PowerShell を管理者モードで起動します(通常のモードで起動せず私ははまりました 笑)
  2. まずはスクリプト実行セキュリティ・ポリシーを "Restricted" に変更します。
Set-ExecutionPolicy RemoteSigned
  1. 続いて、以下を実行します。
Install-Module AzureRM
Install-AzureRM
Install-Module Azure
Import-AzureRM
Import-Module Azure

Azure 管理に必要な構成ファイルの取得

構成ファイルは手で記述することなくダウンロードすることができます。

  1. Get-AzurePublishSettingsFile を実行(一般権限でも大丈夫)
  2. Webブラウザが起動して以下の画面が表示され、構成ファイルが自動的にダウンロードされます。キャプチャ.PNG
  3. 取得した構成ファイルを取り込みます。
Import-AzurePublishSettingsFile "ダウンロードしたファイルのフルパス"

# 取り込んだ情報の確認
Get-AzureSubscription

SubscriptionId            : abcdefgh-d999-4824-947x-654332123456
SubscriptionName          : Hogehoge Subscription
Environment               : AzureCloud
DefaultAccount            : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
IsDefault                 : True
IsCurrent                 : True
TenantId                  :
CurrentStorageAccountName :

SubscriptionId            : ca1ca45d-3726-4567-x9f3-xyzaca7dbabc
SubscriptionName          : Piyopiyo Subscription
Environment               : AzureCloud
DefaultAccount            : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
IsDefault                 : False
IsCurrent                 : False
TenantId                  :
CurrentStorageAccountName :

これは最初に1回だけやればOK。次回以降、これを繰り返す必要はありません。

4
4
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
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?