Skip to content

Instantly share code, notes, and snippets.

@juanesech
Last active April 15, 2020 14:38
Show Gist options
  • Save juanesech/5081d0ebbaa71c1dbeffab9aadf327b0 to your computer and use it in GitHub Desktop.
Save juanesech/5081d0ebbaa71c1dbeffab9aadf327b0 to your computer and use it in GitHub Desktop.
Select a azure subscription that contains a string pattern in his name
$subsNames = @(Get-AzSubscription | select name)
foreach ($name in $subsNames) {
if ($name -match "USWE") {
Get-AzSubscription -SubscriptionName $name | Set-AzContext
#Commands to run into subscription
Get-AzResourceGroup
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment