Created
October 12, 2021 13:01
-
-
Save azMantas/b1c5ba8620450d6eff1987b1cddf041a to your computer and use it in GitHub Desktop.
powershell function to get a list of subscription
This file contains 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
function get-subscription { | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[string]$name | |
) | |
Get-AzSubscription | Where-Object { ($_.Name -match $name -and $_.State -ne 'Disabled') } | Select-Object name, id | Sort-Object name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add function to autoload
code $Home\Documents\PowerShell\Profile.ps1
Get-ChildItem C:\git\azNotes\pwsh*functions.ps1 | ForEach-Object{. $_ }
once you have a supscription Id, run Select-AzSubscription -SubscriptionId XXXXX-XXXXX-XXXXX-XXXXX-XXXX