Skip to content

fix: handle access denied for backup plans in linked accounts#123

Open
mtellin wants to merge 1 commit into
masterfrom
fix/aws-linked-account-backup-plans
Open

fix: handle access denied for backup plans in linked accounts#123
mtellin wants to merge 1 commit into
masterfrom
fix/aws-linked-account-backup-plans

Conversation

@mtellin

@mtellin mtellin commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Wraps backup vault traversal calls in per-plan try/catch blocks so a failure for one linked account doesn't abort all remaining backup plans
  • Adds -ErrorAction Stop to Get-BAKBackupPlan, Get-BAKBackupVault, Get-BAKProtectedResourceList so errors are caught properly
  • Adds inner try/catch around Get-BAKRecoveryPoint so one inaccessible recovery point doesn't skip remaining resources
  • Only exports protected_objects.csv when there's data to write

Previously, all backup plan processing was inside a single outer try/catch — if any Get-BAK* call failed (e.g., payer account without access to a linked account's backup plans), the script would abort all backup plan processing for that region.

Closes #84

Test plan

  • Run against an AWS Org where the scanning role has limited access to some linked accounts' backup plans
  • Verify script continues processing remaining plans after one fails
  • Confirm error messages identify the specific plan/account/region that failed

🤖 Generated with Claude Code

Wraps backup vault traversal (Get-BAKBackupPlan, Get-BAKBackupVault,
Get-BAKProtectedResourceList, Get-BAKRecoveryPoint) in per-plan
try/catch blocks so a failure in one linked account doesn't abort
processing for all remaining backup plans. Adds -ErrorAction Stop
to ensure errors are caught properly.

Closes #84

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mtellin mtellin force-pushed the fix/aws-linked-account-backup-plans branch from 92ab190 to 52e0cc8 Compare June 22, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS Sizing script errors out when there's no access to backup plans in linked accounts

1 participant