LoginSignup
4
2

More than 5 years have passed since last update.

プロキシ環境下でAzurePowerShellを使う

Last updated at Posted at 2018-03-04

プロキシ環境下でAzurePowershellのコマンドを実行する時は、powershell立ち上げた後、以下を実行しておくとプロキシを経由でのアクセスになる。

プロキシURLの設定

$proxyString = "http://127.1.0.1:8888" #プロキシサーバのURL
$proxyUri = new-object System.Uri($proxyString)
[System.Net.WebRequest]::DefaultWebProxy = new-object System.Net.WebProxy ($proxyUri, $true)

プロキシ認証の設定

System.Net.WebRequest]::DefaultWebProxy.Credentials = Get-Credential

Login-AzureRmAccountなどでポップアップするMicrosoftアカウントのログイン画面についてはIEのブラウザ側でプロキシ設定が必要。上記はあくまでpowershellで実行されるRESTアクセスに対するプロキシ設定。
最近だとCloud ShellのPowerShellを使う選択肢もあるけど、一応プレビューだし、classic(ASM)は対応してないので、ローカルでAzurePowershellを使う時もあるだろうということでメモ。

Azure Cloud Shell の概要
https://docs.microsoft.com/ja-jp/azure/cloud-shell/overview

参考

Quick Tip: Using Azure PowerShell with Web Proxy and Fiddler

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