Azure Role Assignments Audit Report
Overview:
Azure Administrators often come across challenges while tracking multiple Azure role assignments and removals. At present Azure provides Activity Logs but they make less sense to non-techsavy stakeholders. For example it includes Role Id, Principal Id but doesn't indicate Role names and Principal names which can make the report more readable. To ensure proper tracking and accountability, we need a comprehensive report that includes the following details:
- Initiator and Timestamp
- User/Group/Principal assigned/removed
- Role assigned/removed
- Scope of the Attempt
Pre-Requisites:
- Export subscription level Activity Logs to a Log Analytics Workspace. For this navigate to Subscription > Activity log > Export Activity Log > Add Diagnostic Setting
- Add Diagnostic Setting to export Administrative logs to a Log Analytic Workspace of your choice and hit the save button:
- Navigate to the Workspace and Retrieve the Workspace ID from the overview section, we'll require this in our script.
Solution:
We have created a solution that retrieves and refines information from the Log Analytic Workspace stored Activity Logs and creates a readable CSV report.
Sample Output:
PowerShell Script:
Please replace with appropriate workspace ID(line 32,33) and output CSV file path(line 57, 78). You can provide same values for both at multiple places. Based on the requirement and Log Analytics Retention the no. of days can also be edited(line 6,20)
Hope this helps!
Published on:
Learn moreRelated posts
From Manual Testing to AI-Generated Automation: Our Azure DevOps MCP + Playwright Success Story
In today’s fast-paced software development cycles, manual testing often becomes a significant bottleneck. Our team was facing a growing backlo...
Cognitive services and Azure ML for Dataflows will be fully retired by September 15th, 2025
This blog is outlining the depreciation announcement for Azure ML and Cognitive services using dataflows.
Azure Developer CLI: From Dev to Prod with One Click
This post walks through how to implement a “build once, deploy everywhere” pattern using Azure Developer CLI (azd) that provisions...
Azure Migrate assessments
AI Builder – Invoice processing and Invoices document type to begin using Azure
Starting on July 21, 2025, the prebuilt model invoice processing and invoices document type (built on Azure Document Intelligence 4.0) will be...
Dataverse: Learn How to Implement Azure Durable Functions – Payment Scenario
Azure Durable Functions is an extension of Azure Functions that offers specialized capabilities, including statefulness, orchestration, handli...
Build reliable Go applications: Configuring Azure Cosmos DB Go SDK for real-world scenarios
When building applications that interact with databases, developers frequently encounter scenarios where default SDK configurations don’...