Skip to content

Commit 4f39de6

Browse files
committed
Add positional parameter to Select-MgProfile.
1 parent f9192e0 commit 4f39de6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Authentication/Authentication/Cmdlets/SelectMgProfile.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Microsoft.Graph.PowerShell.Authentication.Cmdlets
1717
[OutputType(typeof(bool))]
1818
public class SelectMgProfile: PSCmdlet
1919
{
20-
[Parameter(Mandatory = true)]
20+
[Parameter(Mandatory = true, Position = 1)]
2121
[Alias("ProfileName")]
2222
[ValidateSet("v1.0", "beta")]
2323
[ValidateNotNullOrEmpty]
@@ -33,10 +33,13 @@ protected override void ProcessRecord()
3333
{
3434
if (this.IsParameterBound(c => c.Name))
3535
{
36-
string profileName = Name.ContainsValue("beta", StringComparison.OrdinalIgnoreCase) ? "v1.0-beta" : Name;
36+
string profileName = Name.ToLower();
37+
// Internally treat beta profile as v1.0-beta.
38+
// This is an AutoREST limitation.
39+
profileName = profileName.ContainsValue("beta") ? "v1.0-beta" : profileName;
3740
PSModuleInfo[] modules = GetModules(InvokeCommand).Where(m => GetProfiles(m).Contains(profileName)).ToArray();
3841
string moduleList = string.Join(", ", modules.Select(m => m.Name));
39-
if (ShouldProcess($"Modules {moduleList}", $"Load modules with profile {Name}"))
42+
if (ShouldProcess($"Modules {moduleList}", $"Load modules with profile {profileName}"))
4043
{
4144
GraphSession.Instance.SelectedProfile = profileName;
4245
ReloadModules(InvokeCommand, modules);

0 commit comments

Comments
 (0)