Deleting Azure "dangling" role assignments
26 Aug 2021Azure 클라우드에서 dangling role assignment 가 200여개가 생겨있길래 지웠다.
청소하는 Azure CLI 스크립트는 다음과 같다.
az role assignment delete --verbose --ids $(az role assignment list --all | jq -r '.[] | if (.resourceGroup | length == 0) and (.principalName | length == 0) then .id else empty end')
Role Assignment
Azure 클라우드에서 RBAC (role based access control) 은 “role assignment” 라는 단위로 정의된다. 하나의 role assignment 는 다음으로 구성된다. 자세한 내용은 Azure Docs에 잘 나와있다.
- assignee or principal (주체): 누구에게
- scope (범위): 어디에서
- role (역할): 무엇을 하도록 허용한다