@Nana Poku Greetings!
Creating a dashboard in Azure to monitor and provide visibility into a policy initiative (set to Audit mode) is a great way to ensure that your team members can track compliance and monitor policy states. Azure provides several ways to achieve this, primarily using Azure Policy, Azure Monitor, and Azure Dashboard. Please follow the step-by-step approach to set up this process.
Ensure that your Policy Initiative (group of policies) is in Audit mode and is correctly assigned to the appropriate scope (subscription, resource group, management group, etc.). This will ensure that your dashboard will reflect accurate compliance data.
If you want to create a dashboard that reflects the compliance state of your Audit mode policy initiative, you will likely want to track and alert on non-compliant resources.
- Go to Azure Monitor in the portal.
- Under Alerts, create a new alert rule.
- Set the condition to trigger when there are non-compliant resources under the specific Policy Initiative. This can be done by querying the Policy Compliance data using Kusto Query Language (KQL) or by using the built-in metric signals for policy compliance.
Example of a KQL query to filter non-compliant resources in the last 30 days:
PolicyComplianceResources
| where ComplianceState == "NonCompliant" and PolicyAssignmentName == "<PolicyInitiativeName>"
| summarize count() by ResourceId, PolicyAssignmentName, ComplianceState
This will help in identifying and alerting on any non-compliant resources, which can be a key data point for your dashboard.
To create a custom dashboard that provides visibility into the status of your Policy Initiative, you can use Azure Dashboards. This allows you to combine multiple visualizations, such as metrics, logs, and alerts.
- Go to the Azure portal.
- In the search bar, type "Dashboards" and select Azure Dashboards.
- Click + New to create a new dashboard.
- Choose the Tile type you want to use. You can add tiles to display:
- Policy compliance status (e.g., using the Policy Compliance widget, showing compliant vs non-compliant resources).
- Metrics for your Audit mode policies.
- Logs from Azure Monitor, such as the results of KQL queries.
- After adding the necessary tiles, arrange and resize them as required.
Add the Policy Compliance Data to the Dashboard
To display policy compliance data (Audit mode) on the dashboard, you can use Log Analytics workbooks or Metrics:
Using Log Analytics Workbook:
- Go to Azure Monitor > Workbooks.
- Create a new workbook.
- Add a query to track the compliance state of your Policy Initiative (you can use the KQL query mentioned earlier).
- Customize the visualizations as needed (e.g., bar charts, pie charts).
- Save the workbook and link it to your dashboard.
Using Policy Compliance Widgets:
- In Azure Dashboards, select the Policy Compliance widget.
- Select the relevant Policy Initiative and set filters (like scope, date range).
- Add the widget to your dashboard to show real-time compliance status.
Grant Access to Other Team Members
Once the dashboard is created, you can provide access to other team members for visibility.
- Go to the Dashboard in the Azure portal.
- Click Share at the top of the dashboard.
- You can either:
- Share with specific users or groups by providing them with Reader or higher access to the dashboard.
- Assign permissions to the dashboard by clicking Manage permissions.
- Add users or groups that should have access (ensure they have the appropriate role, e.g., Reader, Contributor, or a custom role).
For a broader level of access, you may also consider sharing access at the subscription or resource group level to ensure that users have visibility across relevant resources.
Hope this helps. Please reply if you have any questions.
If the response helped, do "Accept Answer" and up-vote it