{"id":20463222,"url":"https://github.com/devwithkrishna/get-azure-role-assignments-using-python","last_synced_at":"2026-05-07T13:08:59.189Z","repository":{"id":237537798,"uuid":"794674724","full_name":"devwithkrishna/get-azure-role-assignments-using-python","owner":"devwithkrishna","description":"This repository contains python code to get the role assignments from azure","archived":false,"fork":false,"pushed_at":"2025-06-19T06:38:29.000Z","size":51,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-21T10:52:06.205Z","etag":null,"topics":["automation","azure","azurerbac","dependabot","github","poetry","python3","role-assignments"],"latest_commit_sha":null,"homepage":"https://github.com/devwithkrishna/get-azure-role-assignments-using-python","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devwithkrishna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-01T18:00:39.000Z","updated_at":"2024-06-22T10:47:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"9e2cdbce-cad4-4da6-af57-e343287b17bd","html_url":"https://github.com/devwithkrishna/get-azure-role-assignments-using-python","commit_stats":null,"previous_names":["devwithkrishna/get-azure-role-assignments-using-python"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devwithkrishna/get-azure-role-assignments-using-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devwithkrishna%2Fget-azure-role-assignments-using-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devwithkrishna%2Fget-azure-role-assignments-using-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devwithkrishna%2Fget-azure-role-assignments-using-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devwithkrishna%2Fget-azure-role-assignments-using-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devwithkrishna","download_url":"https://codeload.github.com/devwithkrishna/get-azure-role-assignments-using-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devwithkrishna%2Fget-azure-role-assignments-using-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276163344,"owners_count":25596014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","azure","azurerbac","dependabot","github","poetry","python3","role-assignments"],"created_at":"2024-11-15T13:09:56.268Z","updated_at":"2025-09-20T21:32:57.729Z","avatar_url":"https://github.com/devwithkrishna.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# get-azure-role-assignments-using-python\nThis repository contains python code to get the role assignments from azure\n\n\n# What this repository do\n\n```markdown\nThis repo contains the source code which can be used to list the role assignments on a subscription level\nfor Azure using Python azure SDK's.\n```\n\n## parameters \n\n| inputs | description | mandatory |\n|--------|-------------|-----------|\n|subscription_id| azure subscription id| :heavy_check_mark: |\n\n## Authentication\n\nAuthentication to Azure is done using service principal credentials\n\nhave a `.env file`\n\n```yaml\nAZURE_CLIENT_ID=\"xxx\"\nAZURE_CLIENT_SECRET=\"xxx\"\nAZURE_TENANT_ID=\"xxx\"\nAZURE_SUBSCRIPTION_ID=\"xxx\"\n```\nWhere xxx refers to the actual values. These will vary for everyone\n\nusing python-dotenv module and fucntion load_dotenv() uses it for local testing.\n\n# Final output \n\n```json\n{\n        \"id\": \"/subscriptions/\u003csubscription id\u003e/providers/Microsoft.Authorization/roleAssignments/\u003cassignment id\u003e\",\n        \"name\": \"\u003cname\u003e\",\n        \"type\": \"Microsoft.Authorization/roleAssignments\",\n        \"principal_id\": \"\u003cprincipal id\u003e\",\n        \"principal_type\": \"\u003c group or user or service principal\u003e\",\n        \"role_definition_id\": \"\u003crole definition id\u003e\",\n        \"assignment_creation_time\": \"\u003cwhen assignment was created\u003e\",\n        \"scope\": \"/subscriptions/\u003csubscription id\u003e\",\n        \"principal_name\": \"\u003cprincipal name\u003e\",\n        \"rbac_role_name\": \"\u003cAzure Rbac or custom role namess\u003e\"\n    }\n```\n\n* for local testing the code creates this as a json file.\n\n# How to run the code locally\n\n```commandline\npython3 role_assignments.py --subscription_id \u003csubscription id\u003e \n```\n\n### For package management poetry is used.\n\n\n## Refernces\n\n* [role-assignments-list](https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-list-rest)\n* [role-based-access-control built-in-roles](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles)\n* [AuthorizationManagementClient](https://learn.microsoft.com/en-us/rest/api/authorization/role-definitions/get?view=rest-authorization-2022-04-01\u0026tabs=Python)\n* [azure graph rbac](https://learn.microsoft.com/en-us/python/api/azure-graphrbac/azure.graphrbac.operations.service_principals_operations.serviceprincipalsoperations?view=azure-python-previous#azure-graphrbac-operations-service-principals-operations-serviceprincipalsoperations-get)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevwithkrishna%2Fget-azure-role-assignments-using-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevwithkrishna%2Fget-azure-role-assignments-using-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevwithkrishna%2Fget-azure-role-assignments-using-python/lists"}