Skip to content

Instantly share code, notes, and snippets.

@azMantas
Created October 12, 2021 13:01
Show Gist options
  • Save azMantas/b1c5ba8620450d6eff1987b1cddf041a to your computer and use it in GitHub Desktop.
Save azMantas/b1c5ba8620450d6eff1987b1cddf041a to your computer and use it in GitHub Desktop.
powershell function to get a list of subscription
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
}
@azMantas
Copy link
Author

azMantas commented Oct 12, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment