Skip to content

Commit f2cb01c

Browse files
authored
[Az.Accounts] Enable telemetry collection for several commands (#22747)
* Enable telemetry collection for Az.Accounts * Enable telemetry collection for Az.Accounts * Enable telemetry collection for Az.Accounts * Updated changelog * Updated changelog * Updated changelog * update changelog
1 parent f20d144 commit f2cb01c

File tree

8 files changed

+15
-19
lines changed

8 files changed

+15
-19
lines changed

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Fixed an issue that the usage of some cmdlets are not counted.
2223

2324
## Version 2.13.0
2425
* Supported in-tool notification for version upgrade.

src/Accounts/Accounts/Context/GetAzureRMContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ protected override IAzureContext DefaultContext
6969
[Parameter(Mandatory = false, ParameterSetName = ListAllParameterSet, HelpMessage = "Refresh contexts from token cache")]
7070
public SwitchParameter RefreshContextFromTokenCache { get; set; }
7171

72-
protected override void BeginProcessing()
72+
protected override bool RequireDefaultContext()
7373
{
74-
// Skip BeginProcessing()
74+
return false;
7575
}
7676

7777
public override void ExecuteCmdlet()

src/Accounts/Accounts/Context/ImportAzureRMContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public class ImportAzureRMContextCommand : AzureContextModificationCmdlet
4646
[ValidateNotNullOrEmpty]
4747
public string Path { get; set; }
4848

49-
protected override void BeginProcessing()
49+
protected override bool RequireDefaultContext()
5050
{
51-
// Do not access the DefaultContext when loading a profile
51+
return false;
5252
}
5353

5454
void CopyProfile(AzureRmProfile source, IProfileOperations target)

src/Accounts/Accounts/DataCollection/EnableAzureRMDataCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ namespace Microsoft.Azure.Commands.Profile
2525
[Cmdlet("Enable", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataCollection", SupportsShouldProcess = true), OutputType(typeof(void))]
2626
public class EnableAzureRmDataCollectionCommand : AzureRMCmdlet
2727
{
28-
protected override void BeginProcessing()
28+
protected override bool RequireDefaultContext()
2929
{
30-
// do not call begin processing there is no context needed for this cmdlet
30+
return false;
3131
}
3232

3333
public override void ExecuteCmdlet()

src/Accounts/Accounts/Environment/AddAzureRMEnvironment.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,9 @@ public string DataLakeAudience
225225
HelpMessage = "Microsoft Graph Url")]
226226
public string MicrosoftGraphUrl { get; set; }
227227

228-
229-
protected override void BeginProcessing()
228+
protected override bool RequireDefaultContext()
230229
{
231-
// do not call begin processing there is no context needed for this cmdlet
230+
return false;
232231
}
233232

234233
public override void ExecuteCmdlet()

src/Accounts/Accounts/Environment/GetAzureRMEnvironment.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using Microsoft.Azure.Commands.Profile.Common;
1818
using Microsoft.Azure.Commands.Profile.Models;
1919
using Microsoft.Azure.Commands.ResourceManager.Common;
20-
using Microsoft.WindowsAzure.Commands.Common;
2120
using System.Linq;
2221
using System.Management.Automation;
2322

@@ -34,12 +33,11 @@ public class GetAzureRMEnvironmentCommand : AzureRMCmdlet
3433
[EnvironmentCompleter()]
3534
public string Name { get; set; }
3635

37-
protected override void BeginProcessing()
36+
protected override bool RequireDefaultContext()
3837
{
39-
// do not call begin processing there is no context needed for this cmdlet
38+
return false;
4039
}
4140

42-
4341
public override void ExecuteCmdlet()
4442
{
4543
var profileClient = new RMProfileClient(AzureRmProfileProvider.Instance.GetProfile<AzureRmProfile>());

src/Accounts/Accounts/Environment/RemoveAzureRMEnvironment.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ public class RemoveAzureRMEnvironmentCommand : AzureContextModificationCmdlet
3737
[EnvironmentCompleter()]
3838
public string Name { get; set; }
3939

40-
protected override void BeginProcessing()
40+
protected override bool RequireDefaultContext()
4141
{
42-
// do not call begin processing there is no context needed for this cmdlet
42+
return false;
4343
}
44-
45-
4644
public override void ExecuteCmdlet()
4745
{
4846

src/Accounts/Accounts/Environment/SetAzureRMEnvironment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ public string DataLakeAudience
196196
HelpMessage = "Microsoft Graph Url")]
197197
public string MicrosoftGraphUrl { get; set; }
198198

199-
protected override void BeginProcessing()
199+
protected override bool RequireDefaultContext()
200200
{
201-
// do not call begin processing there is no context needed for this cmdlet
201+
return false;
202202
}
203203

204204
public override void ExecuteCmdlet()

0 commit comments

Comments
 (0)