Added front door routes and sql stats queries

This commit is contained in:
Jurjen Ladenius
2025-08-07 16:04:01 +02:00
parent 8a00c1db87
commit 76179410ce
4 changed files with 186 additions and 1 deletions

View File

@@ -0,0 +1,77 @@
# .\FrontDoorRoutes.ps1 -SubscriptionId "4820b5d8-cc1d-49bd-93e5-0c7a656371b7" -ResourceGroupName "my-effectory-global" -FrontDoorName "my-effectory-frontDoor"
param(
[Parameter(Mandatory=$false)]
[string]$SubscriptionId,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[string]$FrontDoorName
)
[string] $date = Get-Date -Format "yyyy-MM-dd HHmm"
$fileName = ".\$date Front Door Routes ($FrontDoorName).csv"
# Connect to Azure if not already connected
if (-not (Get-AzContext)) {
Connect-AzAccount
}
# Select subscription if provided
if ($SubscriptionId) {
Select-AzSubscription -SubscriptionId $SubscriptionId
Write-Host "Selected subscription: $SubscriptionId" -ForegroundColor Yellow
}
try {
# Get Front Door profile
$frontDoor = Get-AzFrontDoorCdnProfile -ResourceGroupName $ResourceGroupName -Name $FrontDoorName
if (-not $frontDoor) {
Write-Error "Front Door '$FrontDoorName' not found in resource group '$ResourceGroupName'"
return
}
# Get all endpoints
$endpoints = Get-AzFrontDoorCdnEndpoint -ResourceGroupName $ResourceGroupName -ProfileName $FrontDoorName
$routeData = @()
foreach ($endpoint in $endpoints) {
# Get routes for each endpoint
$routes = Get-AzFrontDoorCdnRoute -ResourceGroupName $ResourceGroupName -ProfileName $FrontDoorName -EndpointName $endpoint.Name
foreach ($route in $routes) {
# Get origin group details
$originGroupId = $route.OriginGroupId
$originGroupName = ($originGroupId -split '/')[-1]
$origins = Get-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $FrontDoorName -OriginGroupName $originGroupName
foreach ($origin in $origins) {
$routeData += [PSCustomObject]@{
FrontDoorName = $FrontDoorName
EndpointName = $endpoint.Name
RouteName = $route.Name
RoutePatterns = ($route.PatternsToMatch -join '; ')
RouteUrl = "https://$($endpoint.HostName)"
OriginGroupName = $originGroupName
OriginName = $origin.Name
OriginUrl = $origin.HostName
OriginEnabled = $origin.EnabledState
RouteEnabled = $route.EnabledState
}
}
}
}
# Export to CSV
Write-Host "Exporting Front Door routes to: $fileName" -ForegroundColor Green
$routeData | Export-Csv -Path $fileName -NoTypeInformation -Force
} catch {
Write-Error "Error retrieving Front Door routes: $($_.Exception.Message)"
}

View File

@@ -26,7 +26,7 @@ $repos = az repos list --organization "https://dev.azure.com/effectory/" --proj
foreach ($repo in $repos)
{
$prs = az repos pr list --project "survey software" --repository "$($repo.name)" --organization "https://dev.azure.com/effectory/" --status all | ConvertFrom-Json | Select-Object
[PullRequest[]]$Result = @()
foreach ($pr in $prs)