LoginSignup
2
1

More than 3 years have passed since last update.

[Azure] DockerからAzure PowerShellを使う

Last updated at Posted at 2021-02-27

前提

  • dockerコマンドが使用できる環境

手順

コンテナーでの Azure PowerShell の使用

次の手順は、イメージをダウンロードし、対話型 PowerShell セッションを開始する

# イメージダウンロード
docker pull mcr.microsoft.com/azure-powershell

# 対話モードでコンテナー実行
docker run -it mcr.microsoft.com/azure-powershell pwsh

サインイン

PS /> Connect-AzAccount -UseDeviceAuthentication

WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code xxx to authenticate.
WARNING: TenantId 'xxx' contains more than one active subscription. First one will be selected for further use. To select another subscription, use Set-AzContext.

ブラウザでコードを入力して、サインイン

複数サブスクリプションがある場合は以下で指定

PS /> Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx"

クライアント証明書をホストからコンテナに送る

# docker ps でコンテナidを取得
docker ps 

# ホストからコンテナにコピー
$ sudo docker cp my.cnf <コンテナID>:/etc/my.cnf

参考

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