Select-AzProfile
Synopsis
Selects or creates an Azure profile.
The Select-AzProfile cmdlet selects or creates an Azure profile. An Azure profile is a collection of subscription information that you can switch between.
When you run Connect-AzAccount, a default profile is created or selected. You can use Select-AzProfile to explicitly choose which profile to use.
This cmdlet is part of the Azure Resource Manager PowerShell module.
Syntax
Select-AzProfile -Name <String> [-DefaultProfile] [<CommonParameters>]Select-AzProfile -InputObject <PSObject> [-DefaultProfile] [<CommonParameters>]
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
-Name |
String | Specifies the name of the profile to select. | True |
-InputObject |
PSObject | Specifies the profile object to select. This object can be piped from Get-AzProfile. |
True |
-DefaultProfile |
SwitchParameter | Specifies that the selected profile should be set as the default profile. | False |
CommonParameters |
Object | Includes common parameters such as Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, OutVariable, PipelineVariable, and Stop. | False |
Examples
Example 1: Select a profile by name
Select-AzProfile -Name "MyDevelopmentProfile"
This command selects the Azure profile named "MyDevelopmentProfile".
Example 2: Select a profile and set it as default
Select-AzProfile -Name "MyProductionProfile" -DefaultProfile
This command selects the "MyProductionProfile" and sets it as the default profile for subsequent operations.
Example 3: Select a profile using pipeline input
Get-AzProfile | Where-Object {$_.Name -eq "StagingProfile"} | Select-AzProfile
This command retrieves all Azure profiles, filters for the one named "StagingProfile", and then selects it.
Notes
Use Get-AzProfile to list available profiles.
When you switch profiles, the context of your Azure PowerShell session changes to reflect the subscriptions and settings of the selected profile.