2023年10月21日土曜日

azcmagent connectでテナントIDを非明示とした場合、全く違うテナントに接続し、connectが失敗する事もあり

頻繁に発生する現象ではないと思いますが、テナントIDを非明示とした場合、全く違うテナントに接続した挙動を見つけましたので、書いておきます。
※別で持っているOffice 365のテナントIDかと思ったが違いました。

こんなメッセージが出て、Azure Arc 対応サーバーの登録が失敗するようになりました。

メッセージは、「終了コード:  AZCM0042: Failed to Create Resource」なのですが、最高の権限を使っていることから、権限周りは考えにくく。

ログファイルは、"C:\ProgramData\AzureConnectedMachineAgent\Log\azcmagent.log"ですので、確認してみました。401のあたりからさかのぼっていくと、こんなメッセージがありました。

time="2023-10-21T09:56:56+09:00" level=debug msg="Azure response" Body="{\"error\":{\"code\":\"InvalidAuthenticationTokenTenant\",\"message\":\"The access token is from the wrong issuer 'https://sts.windows.net/f8cdef31-マスキングしてます/'. It must match the tenant 'https://sts.windows.net/2156436d-マスキングしてます/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/2156436d-マスキングしてます' to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later.\"}}" Error Code=InvalidAuthenticationTokenTenant Operation=GET Status Code=401

上記赤字部分で別テナントへなぜか接続してますね。別のテナントだと権限がないわけで、エラーコートとしてはそうなります。

解決方法は、--tenant-idオプションにてテナントIDを明示的に指定します。

登録失敗が解消しました!

0 件のコメント:

コメントを投稿