Azure Profile Cmdlets - MabOneSdk/azure-powershell GitHub Wiki
We should add -Profile to all existing commands, except for the ones that are reading local profile file, e.g., Clear-AzureProfile and also Select-AzureSubscription -Default.
Add-AzureAccount [[-Profile] <AzureProfile>]
Get-AzureWebsite [[-Profile] <AzureProfile>]
New-AzureResourceGroup [[-Profile] <AzureProfile>]
......
Parameters
Add the following parameters
Name | Type | Required | Default Value | Description |
---|---|---|---|---|
Profile |
AzureProfile | No | local azure profile | Feeds the Azure profile (accounts, environments, etc) for the command to read from. If not specified, read from local default profile file. |
Examples
Add-AzureAccount <Other cmdlet parameters> -Profile $profile
Get-AzureWebsite <Other cmdlet parameters> -Profile $profile
New-AzureResourceGroup <Other cmdlet parameters> -Profile $profile
# Parameter Set: Certificate
New-AzureProfile [-Environment <AzureEnvironment>] [-SubscriptionId] <Guid> [-StorageAccount <String>] [-Certificate] <X509Certificate>
# Parameter Set: PSCredential
New-AzureProfile [-Environment <AzureEnvironment>] [-SubscriptionId] <Guid> [-StorageAccount <String>] [-Credential] <PSCredential> # Use user principal
New-AzureProfile [-Environment <AzureEnvironment>] [-SubscriptionId] <Guid> [-StorageAccount <String>] [-Credential] <PSCredential> [-Tenant] <Guid> -ServicePrincipal# Use service principal
# Parameter Set: Token
New-AzureProfile [-Environment <AzureEnvironment>] [-SubscriptionId] <Guid> [-StorageAccount <String>] [-AccountId] <String> [-AccessToken] <String>
# Parameter Set: Property Bag
New-AzureProfile [-Properties] <Hashtable>
# Parameter Set: File
New-AzureProfile [-Path] <String> [-Source IDataStore]
Parameters
Name | Type | Required | Default Value | Description |
---|---|---|---|---|
Environment |
AzureEnvironment | No | AzureCloud | The Azure Environment object. |
SubscriptionId |
Guid | Yes | N/A | The subscription Guid. |
StorageAccount |
String | No | N/A | The storage account name. |
Certificate |
X509Certificate | Yes | N/A | The certificate object. |
Credential |
PSCredential | Yes | N/A | the PSCredential object with user name and password. |
Tenant |
Guid | Yes | N/A | The tenant id for the service principal. |
Properties |
Hashtable | Yes | N/A | The property bag for the profile properties. The key names are same as the cmdlet other parameters. |
Path |
String | Yes | None | The path to load profile file from. |
Source |
IDataStore | No | Disk Store | The data store object. |
AccessToken |
String | Yes | N/A | JWT token. |
AccountId |
String | Yes | N/A | The unique identifier for the access token. |
Output
AzureProfile object.
Examples
New-AzureProfile -SubscriptionId 058DE55E-28E0-49E7-8CF2-6701D4A88EF5 -Environment AzureChinaCloud -StorageAccount myStorage -Certificate $cert
New-AzureProfile -SubscriptionId 058DE55E-28E0-49E7-8CF2-6701D4A88EF5 -Environment AzureChinaCloud -StorageAccount myStorage -Credential $(Get-Credential)
New-AzureProfile -SubscriptionId 058DE55E-28E0-49E7-8CF2-6701D4A88EF5 -Environment AzureChinaCloud -StorageAccount myStorage -Credential $(Get-Credential) -Tenant 0BD8B108-B47E-4476-A6D7-EC0FCAB0973E
$profile = New-AzureProfile -Path C:\azureProfile.json
# Parameter Set: Disk
Save-AzureProfile [-Profile] <AzureProfile> [[-Path] <String>] [[-Source] <IDataStore>] [[-PassThru] SwitchParameter]
Parameters
Name | Type | Required | Default Value | Description |
---|---|---|---|---|
Profile |
AzureProfile | Yes | N/A | The azure profile object to save. |
Path |
String | No | Default Azure PowerShell profile | The path to save profile file. |
Source |
IDataStore | No | Disk Store | The data store object. |
PassThru |
SwitchParameter | No | false | If specified the profie object is displayed. |
Output
AzureProfile object.
Examples
Save-AzureProfile -Profile $profile -Path C:\azureProfile.json
Select-AzureProfile [-Profile] <AzureProfile>
Parameters
Name | Type | Required | Default Value | Description |
---|---|---|---|---|
Profile |
AzureProfile | Yes | N/A | The azure profile object to save. |
Note Update Select-AzureSubscription deprecating -Current and -Default
Output
AzureProfile object.
Examples
Select-AzureProfile -Profile $profile