Skip to content

Instantly share code, notes, and snippets.

@gpsarkar
Last active August 29, 2021 20:31
Show Gist options
  • Save gpsarkar/fac4128c925e3c2de4c5e70884aa78fd to your computer and use it in GitHub Desktop.
Save gpsarkar/fac4128c925e3c2de4c5e70884aa78fd to your computer and use it in GitHub Desktop.
azure powershell notes
// get ps version
Get-Host | Select-Object Version
$PSVersionTable.PSVersion
// get azure powershell version
Get-Module -ListAvailable -Name Az
Get-Module -ListAvailable -Name Azure -Refresh
// get apim services
Get-AzApiManagement
// get apim service by id
Get-AzApiManagement -ResourceId /subscriptions/GUID/resourceGroups/RESOURCE_GROUP/providers/Microsoft.ApiManagement/service/SERVICENAME
// get all apis
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "RESOURCE_GROUP" -ServiceName "SERVICENAME"
Get-AzApiManagementApi -Context $ApiMgmtContext
//Create new aspi
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "RESOURCE_GROUP" -ServiceName "SERVICENAME"
New-AzApiManagementApi -Context $ApiMgmtContext -Name "gs test api" -ServiceUrl "https://URL" -Protocols @("http", "https") -Path "dev"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment