Skip to content

Instantly share code, notes, and snippets.

View sriramvaidyanathan's full-sized avatar

Sriram Vaidyanathan sriramvaidyanathan

View GitHub Profile
@sriramvaidyanathan
sriramvaidyanathan / create_pr.sh
Created September 13, 2024 18:25 — forked from slavingia/create_pr.sh
Create a (draft) pull request using GitHub CLI
#!/bin/bash
# Create a (draft) pull request using GitHub CLI.
# It assigns the PR to the current user, fills in the title from the first commit,
# and uses the PR template file for the description.
set -euo pipefail
# Colors for output
RED='\033[0;31m'
@sriramvaidyanathan
sriramvaidyanathan / azure-policy-inventory.md
Created January 20, 2023 16:17 — forked from timothywarner/azure-policy-inventory.md
Azure Resource Graph Explorer built-in sample that inventories Azure Policy assignments.
// Policy assignments and information about each of its respective definitions
// Gets policy assignments in your environment with the respective assignment name,definition associated, category of definition (if applicable), as well as whether the definition type is an initiative or a single policy.

policyResources
| where type =~'Microsoft.Authorization/PolicyAssignments'
| project policyAssignmentId = tolower(tostring(id)), policyAssignmentDisplayName = tostring(properties.displayName), policyAssignmentDefinitionId = tolower(properties.policyDefinitionId)
| join kind=leftouter(
 policyResources
 | where type =~'Microsoft.Authorization/PolicySetDefinitions' or type =~'Microsoft.Authorization/PolicyDefinitions'