背景
はじめて Service Connection を作ったころに嵌った記録
現象
- ARM で Service connection が作成出来ない。verify error になって、以下のえらーとなる。
- ARM: Azure Resource Manager
Failed to query service connection API: 'https://management.azure.com/subscriptions/{subscription id}?api-version=2016-06-01 '. Status Code: 'Forbidden', Response from server: '{"error":{"code":"AuthorizationFailed","message":"The client '{client id}' with object id '{object id}' does not have authorization to perform action 'Microsoft.Resources/subscriptions/read' over scope '/subscriptions/{subscription id}' or the scope is invalid. If access was recently granted, please refresh your credentials."}}'
ActivityId: {activity id}
原因
上記文章に書かれている通り、Microsoft.Resources/subscriptions/read
が無い。
ということで、Azure Portal 側で、割り当てようとしてた Service Principal に対して、Microsoft.Resources/subscriptions/read
を持つ Role を割り当ててやればよい。
もちろん、カスタムロールを作成してもOK
あとがき
RBAC すらもまだ理解していなかった頃であり
- アクセス権が無い=アプリ登録時になにか設定不足だった?
と考えて詰まっていた。
というのも、会社でやろうとしていて、アプリ登録は書類申請だった為に、試行錯誤の前に調べないとダメだったから、非常に悩んだ思い出・・。
理解する為にも、試行環境が欲しいなぁと、思っていた。今は VS Subscription の環境があるので助かる