Fix multi-subscription array interpolation in CreateBody#1
Open
jcoetsie wants to merge 2 commits into
Open
Conversation
When multiple subscriptions are passed, PowerShell interpolates a
string[] into a space-joined string, producing an invalid subscription
ID that causes an Azure InternalServerError.
Map each element individually so the JSON body contains a properly
formatted array of "subscriptions/{id}" entries.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When -Table is specified, results are formatted as a pivot table where the source AZ is the row header and each target subscription (resolved to its display name) is a column, making zone mapping easy to compare at a glance. Without -Table the original raw output is unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Bug fix: multi-subscription array interpolation in
CreateBody$Targetsubscriptionis declared asstring[], so when two or more subscription IDs are passed, PowerShell's string interpolation joins them with a space inside a single"subscriptions/..."string — producing an invalid value that triggers an AzureInternalServerErrorfrom thecheckZonePeersAPI.ForEach-Objectso the JSON body contains a properly formatted array of"subscriptions/{id}"entries.Before:
After:
New feature:
-Tableswitch for compact pivot table outputAdds an optional
-Tableswitch that outputs results as a pivot table, resolving subscription IDs to their display names. Each row is a source AZ; each column is a target subscription:Subscription names are resolved via
Get-AzSubscriptionand fall back to the raw ID if inaccessible. Without-Table, the original raw output is unchanged.Test plan
-Targetsubscription— still works, raw output unchanged-Targetsubscriptionvalues — no longer returnsInternalServerError-Table— pivot table is displayed with resolved subscription names-Tableagainst a subscription the caller cannot read — falls back to subscription ID in column header🤖 Generated with Claude Code