Skip to content

Commit a97425a

Browse files
committed
fixing login bug
1 parent fb4a16b commit a97425a

8 files changed

+34
-71
lines changed

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/AzureRM.AnalysisServices.ServiceManagement.psd1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ ScriptsToProcess = @()
5454
TypesToProcess = @()
5555

5656
# Format files (.ps1xml) to be loaded when importing this module
57-
FormatsToProcess = @(
58-
'.\Microsoft.Azure.Commands.AnalsysisServices.ServiceManagement.format.ps1xml'
59-
)
57+
FormatsToProcess = @()
6058

6159
# Modules to import as nested modules of the module specified in ModuleToProcess
6260
NestedModules = @(

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/Commands.AnalysisServices.ServiceManagement.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@
109109
<None Include="AzureRM.AnalysisServices.ServiceManagement.psd1">
110110
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
111111
</None>
112-
<None Include="Microsoft.Azure.Commands.AnalsysisServices.ServiceManagement.format.ps1xml">
113-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
114-
</None>
115112
<None Include="Microsoft.Azure.Commands.AnalysisServices.ServiceManagement.dll-help.psd1">
116113
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
117114
</None>

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/Commands/AddAzureASAccount.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ public override void ExecuteCmdlet()
108108
}
109109

110110
var asAzureProfile = AsAzureClientSession.Instance.Login(currentProfile.Context, password);
111-
currentProfile.Environments.Add(AsEnvironment.Name, AsEnvironment);
111+
if (!currentProfile.Environments.ContainsKey(EnvironmentName))
112+
{
113+
currentProfile.Environments.Add(AsEnvironment.Name, AsEnvironment);
114+
}
115+
112116
WriteObject(asAzureProfile);
113117
}
114118
#pragma warning restore 0618

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/Commands/Restart-AzureAsInstance.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ public class RestartAzureAnalysisServer: AzurePSCmdlet, IModuleAssemblyInitializ
3636
[ValidateNotNullOrEmpty]
3737
public string Instance { get; set; }
3838

39-
[Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation.")]
40-
public SwitchParameter Force { get; set; }
41-
4239
protected override AzureContext DefaultContext { get; }
4340

4441
protected override void SaveDataCollectionProfile()
@@ -77,23 +74,26 @@ public override void ExecuteCmdlet()
7774
{
7875
if (!string.IsNullOrEmpty(Instance))
7976
{
80-
var context = AsAzureClientSession.Instance.Profile.Context;
81-
var restartEndpoint = string.Format(context.Environment.Endpoints[AsAzureEnvironment.AsRolloutEndpoints.RestartEndpointFormat], Instance);
82-
string restartBaseUri = string.Format("https://{0}", context.Environment.Name);
83-
var accessToken = AsAzureClientSession.GetAadAuthenticatedToken(
84-
context,
85-
null,
86-
PromptBehavior.Auto,
87-
AsAzureClientSession.AsAzureClientId,
88-
restartBaseUri,
89-
AsAzureClientSession.RedirectUri);
90-
91-
using (HttpResponseMessage message = CallPostAsync(
92-
new Uri(restartBaseUri),
93-
restartEndpoint,
94-
accessToken).Result)
77+
if (ShouldProcess(Instance, Resources.RestartingAnalysisServicesServer))
9578
{
96-
message.EnsureSuccessStatusCode();
79+
var context = AsAzureClientSession.Instance.Profile.Context;
80+
var restartEndpoint = string.Format(context.Environment.Endpoints[AsAzureEnvironment.AsRolloutEndpoints.RestartEndpointFormat], Instance);
81+
string restartBaseUri = string.Format("https://{0}", context.Environment.Name);
82+
var accessToken = AsAzureClientSession.GetAadAuthenticatedToken(
83+
context,
84+
null,
85+
PromptBehavior.Auto,
86+
AsAzureClientSession.AsAzureClientId,
87+
restartBaseUri,
88+
AsAzureClientSession.RedirectUri);
89+
90+
using (HttpResponseMessage message = CallPostAsync(
91+
new Uri(restartBaseUri),
92+
restartEndpoint,
93+
accessToken).Result)
94+
{
95+
message.EnsureSuccessStatusCode();
96+
}
9797
}
9898
}
9999
else

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/Microsoft.Azure.Commands.AnalsysisServices.ServiceManagement.format.ps1xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/Microsoft.Azure.Commands.AnalysisServices.ServiceManagement.dll-help.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,6 @@
125125
</maml:description>
126126
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
127127
</command:parameter>
128-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false">
129-
<maml:name>Force</maml:name>
130-
<maml:description>
131-
<maml:para>A switch parameter that will skip confirming the operation.</maml:para>
132-
</maml:description>
133-
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
134-
</command:parameter>
135128
</command:syntaxItem>
136129
</command:syntax>
137130
<command:parameters>
@@ -147,18 +140,6 @@
147140
</dev:type>
148141
<dev:defaultValue></dev:defaultValue>
149142
</command:parameter>
150-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false">
151-
<maml:name>Force</maml:name>
152-
<maml:description>
153-
<maml:para>A switch parameter that will skip confirming the operation.</maml:para>
154-
</maml:description>
155-
<command:parameterValue required="true" variableLength="false">SwitchParameter</command:parameterValue>
156-
<dev:type>
157-
<maml:name>String</maml:name>
158-
<maml:uri/>
159-
</dev:type>
160-
<dev:defaultValue></dev:defaultValue>
161-
</command:parameter>
162143
</command:parameters>
163144
<command:inputTypes>
164145
<command:inputType>

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/Properties/Resources.Designer.cs

Lines changed: 6 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.ServiceManagement/Properties/Resources.resx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,10 @@
123123
<data name="NotLoggedInMessage" xml:space="preserve">
124124
<value>Run Login-AzureAsAccount to login to Analysis Services server</value>
125125
</data>
126+
<data name="RestartingAnalysisServicesServer" xml:space="preserve">
127+
<value>Restart Analysis Services Server</value>
128+
</data>
126129
<data name="UnknownEnvironment" xml:space="preserve">
127130
<value>Unknown Analysis Services environment name specified.</value>
128131
</data>
129-
<data name="UpdateAnalysisServicesServer" xml:space="preserve">
130-
<value>Are you sure you want to update Analysis Services server: '{0}'?</value>
131-
</data>
132-
<data name="UpdatingAnalysisServicesServer" xml:space="preserve">
133-
<value>Update Analysis Services Server</value>
134-
</data>
135132
</root>

0 commit comments

Comments
 (0)