{"id":19491211,"url":"https://github.com/cloudyspells/psrazdo-workbooks","last_synced_at":"2025-04-25T19:32:17.683Z","repository":{"id":215318237,"uuid":"738464183","full_name":"cloudyspells/PsrAzDo-workbooks","owner":"cloudyspells","description":"Azure Monitor workbooks for Analyzing PSRule.Rules.AzureDevOps results","archived":false,"fork":false,"pushed_at":"2024-02-04T18:48:13.000Z","size":51,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T02:41:29.525Z","etag":null,"topics":["azure","azure-devops","azure-monitor","best-practices","bicep","psrule"],"latest_commit_sha":null,"homepage":"","language":"Bicep","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/cloudyspells.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["cloudyspells"]}},"created_at":"2024-01-03T09:37:48.000Z","updated_at":"2024-01-26T13:18:21.000Z","dependencies_parsed_at":"2024-01-11T23:46:25.630Z","dependency_job_id":"3ab01f84-fb1d-4868-9c6c-2c584b0abf3e","html_url":"https://github.com/cloudyspells/PsrAzDo-workbooks","commit_stats":null,"previous_names":["cloudyspells/psrazdo-workbooks"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPsrAzDo-workbooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPsrAzDo-workbooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPsrAzDo-workbooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudyspells%2FPsrAzDo-workbooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudyspells","download_url":"https://codeload.github.com/cloudyspells/PsrAzDo-workbooks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250882637,"owners_count":21502341,"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","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":["azure","azure-devops","azure-monitor","best-practices","bicep","psrule"],"created_at":"2024-11-10T21:16:08.726Z","updated_at":"2025-04-25T19:32:17.362Z","avatar_url":"https://github.com/cloudyspells.png","language":"Bicep","funding_links":["https://github.com/sponsors/cloudyspells"],"categories":[],"sub_categories":[],"readme":"# PSRule.Rules.AzureDevOps Azure Monitor Workbooks\n\n## Overview\n\nThis repository contains an Azure Monitor Workbooks deployment\nwritten in [Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/)\nfor analyzing [PSRule.Rules.AzureDevOps](https://github.com/cloudyspells/PSRule.Rules.AzureDevOps)\nresults captured to an Azure Log Analytics workspace. Azure Pipelines and GitHub Actions\nyaml templates are included to setup a daily analysis of Azure DevOps Organizations with\nPSRule. The analysis will loop through all projects in the organization and capture\nthe results.\n\n[![Demo video on YouTube](https://img.youtube.com/vi/bcF7mf3MlbQ/0.jpg)](https://www.youtube.com/watch?v=bcF7mf3MlbQ)\n\n## Getting Started\n\nThe following steps will guide you through deploying the log analytics workspace and\nworkbooks to your Azure subscription.\n\n### Prerequisites\n\n- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) version 2.20.0 or later.\n- Local copy of this repository. Use `git clone` to download and maintain a local copy of this repo.\n\n### Deployment\n\nThe following steps will guide you through deploying the log analytics workspace,\nworkbooks and a keyvault to your Azure subscription. In your local copy of this\nrepository, run the following command to create a new resource group:\n\n```powershell\n# Set the location to deploy to\n$location = 'westeurope'\n# Set the resource group name\n$resourceGroupName = 'rg-psrule-azuredevops-weu'\n# Create the resource group in the specified location\naz group create --name $resourceGroupName --location $location\n```\n\nNext, run the following command to deploy the log analytics workspace and workbooks:\n\n```powershell\naz deployment group create `\n    --resource-group $resourceGroupName `\n    --template-file .\\src\\bicep\\main.bicep `\n    --query properties.outputs `\n    -p azDoOrganization='contoso' `\n    -p azDoPAT='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\n```\n\nThe deployment will take approximately 5 minutes to complete. After the deployment\nhas completed, there will be a log analytics workspace with workbooks and a key vault\navailable in the resource group. The key vault will contain the necessary secrets\nto run the analysis with PSRule from an Azure Pipeline.\n\n### Azure Pipelines\n\nThe following steps will guide you through setting up a daily analysis of Azure DevOps projects\nwith PSRule using Azure Pipelines.\n\n#### Create a repository in Azure DevOps\n\nCreate a new repository in Azure DevOps to store the pipeline definition. To create a new\nrepository, follow the steps in [Create a repo](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-new-repo?view=azure-devops\u0026tabs=browser).\nAfter creating the repository, clone it to your local machine and add the following files\nto the root of the repository:\n\n- `azure-pipelines/psrule-azdo-loganalytics.yaml`\n\n#### Add the Key Vault as a Variable Group in Azure DevOps\n\nAdd the key vault as a variable group in Azure DevOps to allow the pipeline to access the\nsecrets. The key vault can be found in the resource group specified in the deployment.\nTo add the key vault as a variable group, follow the steps in [Create a variable group](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops\u0026tabs=yaml#create-a-variable-group).\nWhen prompted to select a source, select `Azure Key Vault` and select the key vault created\nin the previous step. Name the variable group `azdo-psrule-run` and select `Allow access to all pipelines`.\n\n#### Create the pipeline\n\nCreate a new pipeline in Azure DevOps to run the PSRule analysis. To create a new pipeline,\nfollow the steps in [Create your first pipeline](https://docs.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline?view=azure-devops\u0026tabs=java%2Cyaml%2Cbrowser%2Ctfs-2018-2).\nWhen prompted to select a template, select `Existing Azure Pipelines YAML file` and\nselect the `azure-pipelines/psrule-azdo-loganalytics.yaml` file from the repository.\n\n#### Run the pipeline\n\nRun the pipeline to verify the setup. The pipeline will run for approximately 2 to 5 minutes depending on the size of the Azure DevOps project. Do not run the pipeline more\nthan once a day as the workbook is designed to analyze a single day of data.\n\n**Note:** When running the pipeline for the first time, it will take up to 15 minutes\nfor data to appear in the workbook.\n\n#### Check the workbook\n\nAfter the pipeline has completed, check the workbook in the log analytics workspace.\nThe main workbook is named `Azure DevOps Main` and is available in the `Workbooks` section\nof the log analytics workspace. The workbook will show the results of the last run in 24\nhour intervals.\n\n## References and acknowledgements\n\n- [PSRule](https://microsoft.github.io/PSRule) by [@BernieWhite](https://github.com/BernieWhite)\n- [PSRule.Monitor](https://github.com/microsoft/PSRule.Monitor) by [@BernieWhite](https://github.com/BernieWhite)\n- [PSRule.Rules.AzureDevOps](https://github.com/cloudyspells/PSRule.Rules.AzureDevOps) by [Roderick Bant](https://github.com/webtonize)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudyspells%2Fpsrazdo-workbooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudyspells%2Fpsrazdo-workbooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudyspells%2Fpsrazdo-workbooks/lists"}