The Connect-AzAccount
cmdlet connects to Azure with an authenticated account for use with cmdlets from the Az PowerShell modules.
Connect to Azure with an authenticated account for use with cmdlets from the Az PowerShell modules.
Connect-AzAccount
Use an interactive login to connect to a specific tenant and subscription
Connect-AzAccount -Tenant 'xxxx-xxxx-xxxx-xxxx' -SubscriptionId 'yyyy-yyyy-yyyy-yyyy'
Login-AzAccount
andAdd-AzAccount
are the aliases build around the Connect-AzAccount cmdlet
Get subscriptions that the current account can access.
The Get-AzSubscription cmdlet gets the subscription ID, subscription name, and home tenant for subscriptions that the current account can access.
Get all subscriptions in all tenants
PS C:\>Get-AzSubscription
Get all subscriptions for a specific tenant
PS C:\>Get-AzSubscription -TenantId "aaaa-aaaa-aaaa-aaaa"
Create and output a new Service Principal with password
$sp = NewAzADServicePrincipal -DisplayName "{sp-name}" -Role "{role}"
$sp
$credentials = New-Object pscredential -ArgumentList "temp", $sp.Secret
$credentials.GetNetworkCredential().password
Get information about the Template Spec named 'MyTemplateSpec' within the resource group 'myRG'.
Get-AzTemplateSpec -ResourceGroupName 'myRG' -Name 'MyTemplateSpec'
Note: All of the Template Spec's versions will be present within the ".Versions" property of the return object.
Gets the metadata used to authenticate Azure Resource Manager requests.
The Get-AzContext cmdlet gets the current metadata used to authenticate Azure Resource Manager requests. This cmdlet gets the Active Directory account, Active Directory tenant, Azure subscription, and the targeted Azure environment.
Get-AzContext [-DefaultProfile <IAzureContextContainer>] [[-Name] <String>] [<CommonParameters>]
Example for getting the context of the current session by calling Get-AzContext.
PS C:\> Get-AzContext
Module: Az.Resources
Creates a new Template Spec version with the specified ARM Template content. The content can either come from a raw JSON string (using FromJsonStringParameterSet parameter set) or from a specified JSON/Bicep file (using FromJsonFileParameterSet parameter set).
The following example creates a new Template Spec version "v1.0" in a Template Spec named "myTemplateSpec". The specified version will have $templateJson as the version's ARM Template content.
$templateJson = @" { "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "resources": [] } "@ New-AzTemplateSpec -ResourceGroupName 'myRG' -Name 'myTemplateSpec' -Version 'v1.0' -Location 'West US' -TemplateJson $templateJson
Additional details at New-AzTemplateSpec (Az.Resources) | Microsoft Docs