[WIP] Remove Azure Retirements functionality from AzResiliencyScanner.ps1#5
Draft
[WIP] Remove Azure Retirements functionality from AzResiliencyScanner.ps1#5
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.
Original prompt
Objective
Remove all Azure Retirements functionality from
OMSSolutions/ResiliencyScannerPublic/AzResiliencyScanner.ps1. The new version focuses exclusively on resiliency scanning and no longer needs retirement detection.Changes Required in
OMSSolutions/ResiliencyScannerPublic/AzResiliencyScanner.ps11. Remove the
Get-AllRetirementsfunction (lines 131–241)Delete the entire function block:
2. Remove the
$retirementsvariable initialisationOn the line that reads:
Delete this line entirely.
3. Remove the
$RetirementsDownloadUrivariableOn the line that reads:
Delete this line entirely.
4. Remove the
Get-AllRetirementscall inside the per-subscription loopOn the line that reads:
Delete this line entirely (including the
#add resource typecomment on the line immediately after it, if it solely relates to retirements context — use judgement; if the comment is still relevant to other code below it, leave it).What to Leave Unchanged
Get-AllAzGraphResourcefunctionGet-AzBAckupASRfunctionparse-objectfunctionInvoke-ResiliencyRulesfunctionInvoke-CatchAllResiliencyfunctionThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: analyze and explain what azresiliencyscannerscript does
Assistant: ## AzResiliencyScanner — What It Does
This is an Azure resiliency assessment tool that scans all resources across one or more Azure subscriptions and classifies each resource's high-availability/redundancy configuration. Here's a full breakdown:
🎯 Purpose
It produces a set of CSV reports answering: "For every Azure resource in my environment, how resilient is it — is it zone-redundant, locally redundant, non-zonal, retiring, etc.?"
⚙️ Parameters
$tenantscope$subscriptionList$customerTags$localexport$true= save CSVs locally;$false= export to Azure Storage$exportstoragesubid/$exportstorageAccount$localexport=$false🔄 Execution Flow
1. Authentication & Subscription Discovery
2. Per-Subscription Data Collection (main loop)
For each enabled subscription, it collects four datasets using Azure Resource Graph (
Search-AzGraph) with automatic pagination via skip tokens:Get-AllAzGraphResourceGet-AzBackupASRGet-AllRetirementsInvoke-AzRestMethod3. Resource Enrichment
Each resource gets additional properties stamped on it:
ResourceType/ResourceSubType(parsed from the ARM resource ID)Subscription,ReportDatelbreportpipreportBackupEnabled,LastBackup) and ASR config (ASREnabled,ASRConfig) joined by resource ID4. Resiliency Classification Engine
This is the core logic — a rule-based engine (
Invoke-ResiliencyRules) that processes each resource against rules defined inResiliencyRules.ps1:ResourceSubTypefor efficient lookupDefaultResiliency— a static value (e.g.,RedundantbyDefaultfor VNets, Key Vaults)ResiliencyLogic— a scriptblock that dynamically evaluates and returns aResiliencyConfig(and optionallyResiliencyDetail,BackupDetails, etc.)MatchFilter— optional pre-filter (e.g., SQL databases only, not master)SkipExtensions— s...This pull request was created from Copilot chat.