Azure Packのテナントサイトで、テンプレートが読み込めない場合の対処法

Azure PackのAdmin PortalがIISリセットかかるたびに、テナントポータルではてんっプレートが読み込めなくなります。

テンプレートを読み込めるようにするには、毎日Admin Portalにログインし、プラン→プラン名→プランサービス(仮想マシンのクラウドなど)をプランがある数全てやらなくてはいけません。

これはAzure Packのバグの様です。

毎日これをやるにはめんどくさすぎる!!

ですので、PowerShellで自動的にプランを読み込んで対処しましょう!

まずPS1を作成します。

# Address to Admin Sites AdminAPI
$adminUri = ‘https://<admin site url>:30004’

# Username to connect to the server
$username = ‘DomainUsername’

# Use this command once to generate the passwords file
# read-host -assecurestring | convertfrom-securestring | out-file C:WAPAdmin-Passwordpassword.txt
$password = get-content C:WAPAdmin-Passwordpassword.txt | convertto-securestring

$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password

$Token = Get-MgmtSvcToken –Type Windows –AuthenticationSite https://<admin Auth Site Url>:30072 –ClientRealm ‘http://azureservices/AdminSite’ -User $Credentials -DisableCertificateValidation
$plans = Get-MgmtSvcPlan -AdminUri $adminUri -Token $token -DisableCertificateValidation:$true

# Loop though all plans and sync them
foreach ($id in $plans) {
write-host Syncing $id.DisplayName
Sync-MgmtSvcPlan -AdminUri $adminUri -Token $token -DisableCertificateValidation:$true -PlanId $id.id
}

次に、初めて実行する場合は、ユーザーのパスワードを暗号化してテキストに保存するコマンドを実行します。

read-host -assecurestring | convertfrom-securestring | out-file C:WAPAdmin-Passwordpassword.txt
実行後、パスワードを入力しEnterを押すと指定したテキストに暗号化されたパスワードが保存されます。

これを、Windows Azure Pack Administration PowerShellを管理者で実行し、PS1を実行します。

Loopで全てのプランを見てくれるので楽ちんです!
実際にうまくいくかは、朝になったら試してみます。

コメント