diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs index f5bd29dd5060..22b9ba0d7a23 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs @@ -50,7 +50,7 @@ public void LoginWithSubscriptionAndTenant() // Setup cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = "2c224e7e-3ef5-431d-a57b-e71f4662e3a6"; - cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47"; + cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"; // Act cmdlt.InvokeBeginProcessing(); @@ -69,7 +69,7 @@ public void LoginWithInvalidSubscriptionAndTenantThrowsCloudException() // Setup cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = "2c224e7e-3ef5-431d-a57b-e71f4662e3a5"; - cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47"; + cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"; // Act cmdlt.InvokeBeginProcessing(); @@ -119,7 +119,7 @@ public void LoginWithNoSubscriptionAndTenant() var cmdlt = new AddAzureRMAccountCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47"; + cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"; // Act cmdlt.InvokeBeginProcessing(); @@ -137,7 +137,7 @@ public void LoginWithSubscriptionname() var cmdlt = new AddAzureRMAccountCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47"; + cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"; cmdlt.SubscriptionName = "Node CLI Test"; // Act @@ -156,7 +156,7 @@ public void LoginWithBothSubscriptionIdAndNameThrowsCloudException() var cmdlt = new AddAzureRMAccountCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47"; + cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"; cmdlt.SubscriptionName = "Node CLI Test"; cmdlt.SubscriptionId = "2c224e7e-3ef5-431d-a57b-e71f4662e3a6"; diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs index 11da48548d2e..6f12018f4a98 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs @@ -49,7 +49,7 @@ public void GetTenantWithTenantParameter() var cmdlt = new GetAzureRMTenantCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47"; + cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"; // Act Login("2c224e7e-3ef5-431d-a57b-e71f4662e3a6", null); @@ -69,7 +69,7 @@ public void GetTenantWithDomainParameter() var cmdlt = new GetAzureRMTenantCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.Tenant = "microsoft.com"; + cmdlt.TenantId = "microsoft.com"; // Act Login("2c224e7e-3ef5-431d-a57b-e71f4662e3a6", null); @@ -107,7 +107,7 @@ private void Login(string subscriptionId, string tenantId) // Setup cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = subscriptionId; - cmdlt.Tenant = tenantId; + cmdlt.TenantId = tenantId; // Act cmdlt.InvokeBeginProcessing(); diff --git a/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs b/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs index 4f9a53d31fe5..2a63234c107f 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs @@ -48,8 +48,9 @@ public class AddAzureRMAccountCommand : AzureRMCmdlet , IModuleAssemblyInitializ [Parameter(ParameterSetName = "User", Mandatory = false, HelpMessage = "Optional tenant name or ID")] [Parameter(ParameterSetName = "ServicePrincipal", Mandatory = true, HelpMessage = "TenantId name or ID")] [Parameter(ParameterSetName = "AccessToken", Mandatory = false, HelpMessage = "TenantId name or ID")] + [Alias("Tenant")] [ValidateNotNullOrEmpty] - public string Tenant { get; set; } + public string TenantId { get; set; } [Parameter(ParameterSetName = "AccessToken", Mandatory = true, HelpMessage = "AccessToken")] [ValidateNotNullOrEmpty] @@ -126,9 +127,9 @@ protected override void ProcessRecord() password = Credential.Password; } - if (!string.IsNullOrEmpty(Tenant)) + if (!string.IsNullOrEmpty(TenantId)) { - azureAccount.SetProperty(AzureAccount.Property.Tenants, new[] { Tenant }); + azureAccount.SetProperty(AzureAccount.Property.Tenants, new[] { TenantId }); } if( AzureRmProfileProvider.Instance.Profile == null) @@ -138,7 +139,7 @@ protected override void ProcessRecord() var profileClient = new RMProfileClient(AzureRmProfileProvider.Instance.Profile); - WriteObject((PSAzureProfile)profileClient.Login(azureAccount, Environment, Tenant, SubscriptionId, + WriteObject((PSAzureProfile)profileClient.Login(azureAccount, Environment, TenantId, SubscriptionId, SubscriptionName, password)); } diff --git a/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml b/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml index cae9dfa3e623..b76a5f0ff7d1 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml +++ b/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml @@ -16,7 +16,7 @@ NOTE THAT THIS CMDLET AUTHENTICATES ONLY AZURE RESOURCE MANAGER CMDLETS. SERVICE MANAGEMENT CMDLETS MUST BE SEPARATELY AUTHENTICATED USING THE ADD-AZUREACCOUNT OR IMPORT-AZUREPUBLISHSETTINGSFILE CMDLETS. - Log in to Azure Resource manager to provide authentication for management cmdlets. Microsoft Account (Live Id) and Oragnization Id credentials may be provided through the dialog prompt. Organizational ID and Service Principal credentials may be provided through a -Credential parameter. Access Token credentials may be provided through the AccessToken credential. By default, user is authenticated agains all available teants. The TenantId parameter may be provided to streamline authentication when access to only a single teant is needed. The SubscriptionId parameter may be provided to select a particular subscription by default, otherwise the first listed subscription will be selected. + Log in to Azure Resource manager to provide authentication for management cmdlets. Microsoft Account (Live Id) and Organization Id credentials may be provided through the dialog prompt. Organizational ID and Service Principal credentials may be provided through a -Credential parameter. Access Token credentials may be provided through the AccessToken credential. By default, user is authenticated against all available tenants. The TenantId parameter may be provided to streamline authentication when access to only a single tenant is needed. The SubscriptionId parameter may be provided to select a particular subscription by default, otherwise the first listed subscription will be selected. @@ -31,12 +31,12 @@ Credential - Securely provide the user id and password for Organization Id credentials or the Application Id and Secret for Service Principal credentials. The provided credentials will be sued to acquire tokens for authenticataing ARM cmdlets with Azure. + Securely provide the user id and password for Organization Id credentials or the Application Id and Secret for Service Principal credentials. The provided credentials will be used to acquire tokens for authenticating ARM cmdlets with Azure. PSCredential - Tenant + TenantId If provided, limit authentication to only the provided tenant. This parameter is required for authentication as a service principal. @@ -76,19 +76,19 @@ Credential - Securely provide the user id and password for Organization Id credentials or the Application Id and Secret for Service Principal credentials. The provided credentials will be sued to acquire tokens for authenticataing ARM cmdlets with Azure. + Securely provide the user id and password for Organization Id credentials or the Application Id and Secret for Service Principal credentials. The provided credentials will be sued to acquire tokens for authenticating ARM cmdlets with Azure. PSCredential ServicePrincipal - When provided, indicates that service princiapl credentials will be provided via the Credential parameter and the Tenant containing the given Servicew Principal will be provided in the TenantId parameter. + When provided, indicates that service principal credentials will be provided via the Credential parameter and the Tenant containing the given Service Principal will be provided in the TenantId parameter. SwitchParameter - Tenant + TenantId If provided, limit authentication to only the provided tenant. This parameter is required for authentication as a service principal. @@ -126,7 +126,7 @@ AzureEnvironment - Tenant + TenantId If provided, limit authentication to only the provided tenant. This parameter is required for authentication as a service principal. @@ -178,7 +178,7 @@ Credential - Securely provide the user id and password for Organization Id credentials or the Application Id and Secret for Service Principal credentials. The provided credentials will be sued to acquire tokens for authenticataing ARM cmdlets with Azure. + Securely provide the user id and password for Organization Id credentials or the Application Id and Secret for Service Principal credentials. The provided credentials will be used to acquire tokens for authenticating ARM cmdlets with Azure. PSCredential @@ -188,7 +188,7 @@ None - Tenant + TenantId If provided, limit authentication to only the provided tenant. This parameter is required for authentication as a service principal. @@ -240,7 +240,7 @@ ServicePrincipal - When provided, indicates that service princiapl credentials will be provided via the Credential parameter and the Tenant containing the given Servicew Principal will be provided in the TenantId parameter. + When provided, indicates that service principal credentials will be provided via the Credential parameter and the Tenant containing the given Service Principal will be provided in the TenantId parameter. SwitchParameter @@ -310,13 +310,13 @@ Add-AzureRmAccount - Displays a dialog where Microsoft Account or Oragnizational Id credentials may be provided. The given credentials will be used to acquire a token for authentication with Azure Resource Manager. Note that if multi-factor authentication (MFA) is enabled for your credentials, you must log in using the interactive option, or use Service Principal authentication. + Displays a dialog where Microsoft Account or Organizational Id credentials may be provided. The given credentials will be used to acquire a token for authentication with Azure Resource Manager. Note that if multi-factor authentication (MFA) is enabled for your credentials, you must log in using the interactive option, or use Service Principal authentication. Account: azureuser@contoso.com Environment: AzureCloud -Subscription: xxxx-xxxx-xxxx-xxxx -Tenant: xxxx-xxxx-xxxx-xxxx +SubscriptionId: xxxx-xxxx-xxxx-xxxx +TenantId: xxxx-xxxx-xxxx-xxxx @@ -340,8 +340,8 @@ Add-AzureRmAccount -Credential $credential Account: azureuser@contoso.onmicrosoft.cn Environment: AzureChinacloud -Subscription: xxxx-xxxx-xxxx-xxxx -Tenant: xxxx-xxxx-xxxx-xxxx +SubscriptionId: xxxx-xxxx-xxxx-xxxx +TenantId: xxxx-xxxx-xxxx-xxxx @@ -387,8 +387,8 @@ Tenant: zzzz-zzzz-zzzz-zzzz Account: user@example.com Environment: AzureCloud -Subscription: yyyy-yyyy-yyyy-yyyy -Tenant: xxxx-xxxx-xxxx-xxxx +SubscriptionId: yyyy-yyyy-yyyy-yyyy +TenantId: xxxx-xxxx-xxxx-xxxx @@ -467,7 +467,7 @@ Tenant: xxxx-xxxx-xxxx-xxxx - Add endpoints and metdaata that allow Azure Resource Manager cmdlets to connect with a new instance of Azure Resource Manager. Built-in environments AzureCloud and AzureChinaCloud target existing public instances of Azure Resource Manager. + Add endpoints and metdata that allow Azure Resource Manager cmdlets to connect with a new instance of Azure Resource Manager. Built-in environments AzureCloud and AzureChinaCloud target existing public instances of Azure Resource Manager. @@ -580,7 +580,7 @@ Tenant: xxxx-xxxx-xxxx-xxxx AdTenant - The default Active Direcotyr Tenant. + The default Active Directory Tenant. String @@ -799,7 +799,7 @@ Tenant: xxxx-xxxx-xxxx-xxxx AdTenant - The default Active Direcotyr Tenant. + The default Active Directory Tenant. String @@ -1168,7 +1168,7 @@ Tenant: xxxx-xxxx-xxxx-xxxx - Get detailed information, inbclusing subscription id, subscription name, and home tenant about subscriptions the current account can access. + Get detailed information, including subscription id, subscription name, and home tenant about subscriptions the current account can access. @@ -1500,7 +1500,7 @@ Subscription Name: Contoso Subscription 1 Get-AzureRmTenant - Tenant + TenantId Tenant to get information about. If not provided, all authorized tenants are returned. @@ -1524,7 +1524,7 @@ Subscription Name: Contoso Subscription 1 - Tenant + TenantId Tenant to get information about. If not provided, all authorized tenants are returned. @@ -2182,9 +2182,9 @@ Subscription Name: Contoso Subscription 1 Set-AzureRmContext - Tenant + TenantId - The tenant to taret in this session. + The tenant to target in this session. AzureTenant @@ -2265,9 +2265,9 @@ Subscription Name: Contoso Subscription 1 - Tenant + TenantId - The tenant to taret in this session. + The tenant to target in this session. AzureTenant @@ -2344,8 +2344,8 @@ Subscription Name: Contoso Subscription 1 Account: user@contoso.com Environment: AzureCloud -Subscription: xxxx-xxxx-xxxx-xxxx -Tenant: yyyy-yyyy-yyyy-yyyy +SubscriptionId: xxxx-xxxx-xxxx-xxxx +TenantId: yyyy-yyyy-yyyy-yyyy @@ -2497,7 +2497,7 @@ Tenant: yyyy-yyyy-yyyy-yyyy AdTenant - The default Active Direcotyr Tenant. + The default Active Directory Tenant. String @@ -2716,7 +2716,7 @@ Tenant: yyyy-yyyy-yyyy-yyyy AdTenant - The default Active Direcotyr Tenant. + The default Active Directory Tenant. String diff --git a/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.format.ps1xml b/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.format.ps1xml index 3b39e514b657..76cc3f806a77 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.format.ps1xml +++ b/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.format.ps1xml @@ -19,11 +19,11 @@ $_.Context.Account.ToString() - + $_.Context.Tenant.ToString() - + $_.Context.Subscription.ToString() @@ -51,10 +51,12 @@ Account - Tenant + + $_.Tenant.ToString() - Subscription + + $_.Subscription.ToString() diff --git a/src/ResourceManager/Profile/Commands.Profile/Tenant/GetAzureRMTenant.cs b/src/ResourceManager/Profile/Commands.Profile/Tenant/GetAzureRMTenant.cs index fd2153b48278..09efdb7d716f 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Tenant/GetAzureRMTenant.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Tenant/GetAzureRMTenant.cs @@ -29,15 +29,15 @@ namespace Microsoft.Azure.Commands.Profile public class GetAzureRMTenantCommand : AzureRMCmdlet { [Parameter(Mandatory = false, Position = 0, ValueFromPipelineByPropertyName = true)] - [Alias("Domain")] + [Alias("Domain", "Tenant")] [ValidateNotNullOrEmpty] - public string Tenant { get; set; } + public string TenantId { get; set; } protected override void ProcessRecord() { var profileClient = new RMProfileClient(AzureRmProfileProvider.Instance.Profile); - WriteObject(profileClient.ListTenants(Tenant).Select((t) => (PSAzureTenant)t), enumerateCollection: true); + WriteObject(profileClient.ListTenants(TenantId).Select((t) => (PSAzureTenant)t), enumerateCollection: true); } } } diff --git a/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs b/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs index d6b81d57ef72..ca8d08d1e60e 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs @@ -40,6 +40,7 @@ public class AddAzureAccount : SubscriptionCmdletBase [Parameter(ParameterSetName = "User", Mandatory = false, HelpMessage = "Optional tenant name or ID")] [Parameter(ParameterSetName = "ServicePrincipal", Mandatory = true, HelpMessage = "Tenant name or ID")] + [Alias("TenantId")] public string Tenant { get; set; } public AddAzureAccount() : base(true) diff --git a/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs b/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs index 890c9137d1bd..de1dbb193d82 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs @@ -82,6 +82,7 @@ public class NewAzureProfileCommand : AzureSMCmdlet [Parameter(Mandatory = false, Position = 2, ParameterSetName = CredentialsParameterSet)] [Parameter(Mandatory = true, Position = 2, ParameterSetName = ServicePrincipalParameterSet)] + [Alias("TenantId")] public string Tenant { get; set; } [Parameter(Mandatory = true, ParameterSetName = ServicePrincipalParameterSet)]