npx aws-azure-login --configure --profile azure-saml
Default Username, Default Role ARN は何も入力せずEnterを押してよい。
? Azure Tenant ID: ea6968e4-7bf7-4a58-b1ac-112da7ee041f
? Azure App ID URI: https://signin.aws.amazon.com/saml
? Default Username:
? Stay logged in: skip authentication while refreshing aws credentials (true|false) (false)
? Default Role ARN (if multiple):
? Default Session Duration Hours (up to 12): (1)
? AWS Region: us-west-1
Profile saved.
~/.aws/config
[profile azure-saml]
azure_tenant_id=ea6968e4-7bf7-4a58-b1ac-112da7ee041f
azure_app_id_uri=https://signin.aws.amazon.com/saml
azure_default_username=
azure_default_duration_hours=1
azure_default_remember_me=false
region=us-west-1
npx aws-azure-login login --profile azure-saml --mode gui
ブラウザ(Choromium)のウィンドウが開く
Logging in with profile 'azure-saml'...
Using AWS SAML endpoint https://signin.aws.amazon.com/saml
Please complete the login in the opened window
ログインに成功すると、ロールを選ぶことができる
ロールを選ぶとクレデンシャル情報が ~/.aws/credentials に保存される。
~/.aws/config と ~/.aws/credentials が存在すれば、codecommitへのアクセスURLを codecommit://(プロファイル名)@(リポジトリ名) としてアクセスできる。
git clone codecommit://(プロファイル名)@(リポジトリ名) (ディレクトリ名)
Note
プロファイル名を指定しない (デフォルト) であれば (リポジトリ名) でいい
次の設定をする
git config --global credential.helper '!aws --profile (プロファイル名) codecommit credential-helper $@'
git config --global credential.UseHttpPath true
設定は ~/.gitconfig に保存される
codecommitへのアクセスURLを https://git-codecommit.(リージョン).amazonaws.com/v1/repos/(リポジトリ名) としてアクセスできる。
git clone https://git-codecommit.(リージョン).amazonaws.com/v1/repos/(リポジトリ名) (ディレクトリ名)
Note
プロファイル名を指定しない (デフォルト) であれば git config --global credential.helper '!aws codecommit credential-helper $@' でいい