Skip to content

Instantly share code, notes, and snippets.

View stusklinar's full-sized avatar

Stu Sklinar stusklinar

View GitHub Profile
{
"mode": "All",
"policyRule": {
"if": {
"field": "Microsoft.Network/publicIPAddresses",
"exists": "true"
},
"then": {
"effect": "Deny"
}
@stusklinar
stusklinar / Uk-Only
Created April 4, 2025 14:36
Azure Locations AZ Policy
{
"mode": "All",
"policyRule": {
"if": {
"not": {
"field": "location",
"in": [
"uksouth",
"ukwest"
]
$collectionurl = "https://azure-devops-url"
$collectionName= "DefaultCollection"
$projectName= "Development"
$baseUrl = "${collectionurl}/$collectionName/$projectName/_apis/build"
$buildDefsReq = (Invoke-RestMethod -Uri $baseUrl/Definitions/ -Method Get -UseDefaultCredential)
foreach($def in $buildDefsReq.value){