Skip to content

Commit 42fbdb0

Browse files
author
Lukasz Stempniewicz
committed
Merge branch 'preview' of https://github.com/Azure/azure-powershell-pr into preview
2 parents a4330c5 + 0a0dd87 commit 42fbdb0

File tree

386 files changed

+217637
-107944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

386 files changed

+217637
-107944
lines changed

src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<Private>True</Private>
5959
</Reference>
6060
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
61-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.9\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
61+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
6464
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

src/Common/Commands.Common.Authentication.Abstractions/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net452" />
88
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net452" />
99
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net452" />
10-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.9" targetFramework="net452" />
10+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
1111
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
1212
</packages>

src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.9\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
75+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7676
<Private>True</Private>
7777
</Reference>
7878
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
79-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.9\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
79+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.10\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
8080
<Private>True</Private>
8181
</Reference>
8282
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/Common/Commands.Common.Authentication/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
99
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
1010
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
11-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.9" targetFramework="net452" />
12-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.9" targetFramework="net452" />
11+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
12+
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
1313
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.3.1" targetFramework="net45" />
1414
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1515
</packages>

src/Common/Commands.Common.Authorization/Commands.Common.Authorization.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
</PropertyGroup>
4747
<ItemGroup>
4848
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
49-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
49+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
5050
<Private>True</Private>
5151
</Reference>
5252
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
53-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.8\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
53+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.10\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
5454
<Private>True</Private>
5555
</Reference>
5656
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
4-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.8" targetFramework="net452" />
3+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
4+
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
55
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
66
</packages>

src/Common/Commands.Common.Graph.RBAC/Commands.Common.Graph.RBAC.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
</PropertyGroup>
4747
<ItemGroup>
4848
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
49-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
49+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
5050
<Private>True</Private>
5151
</Reference>
5252
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
53-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.8\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
53+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.10\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
5454
<Private>True</Private>
5555
</Reference>
5656
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

src/Common/Commands.Common.Graph.RBAC/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net452" />
55
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net452" />
66
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net452" />
7-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
8-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.8" targetFramework="net452" />
7+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
8+
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
99
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
1010
</packages>

src/Common/Commands.Common.Network/Commands.Common.Network.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
</PropertyGroup>
4747
<ItemGroup>
4848
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
49-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
49+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
5050
<Private>True</Private>
5151
</Reference>
5252
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
53-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.8\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
53+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.10\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
5454
<Private>True</Private>
5555
</Reference>
5656
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">

src/Common/Commands.Common.Network/Models/EffectiveNetworkSecurityGroup.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ public EffectiveNetworkSecurityGroup()
3636
/// that is applied.</param>
3737
/// <param name="effectiveSecurityRules">A collection of effective
3838
/// security rules.</param>
39-
public EffectiveNetworkSecurityGroup(SubResource networkSecurityGroup = default(SubResource), EffectiveNetworkSecurityGroupAssociation association = default(EffectiveNetworkSecurityGroupAssociation), IList<EffectiveNetworkSecurityRule> effectiveSecurityRules = default(IList<EffectiveNetworkSecurityRule>))
39+
/// <param name="tagMap">Tag map.</param>
40+
public EffectiveNetworkSecurityGroup(SubResource networkSecurityGroup = default(SubResource), EffectiveNetworkSecurityGroupAssociation association = default(EffectiveNetworkSecurityGroupAssociation), IList<EffectiveNetworkSecurityRule> effectiveSecurityRules = default(IList<EffectiveNetworkSecurityRule>), IDictionary<string, List<string>> tagMap = default(IDictionary<string, List<string>>))
4041
{
4142
NetworkSecurityGroup = networkSecurityGroup;
4243
Association = association;
4344
EffectiveSecurityRules = effectiveSecurityRules;
45+
TagMap = tagMap;
4446
CustomInit();
4547
}
4648

@@ -66,5 +68,10 @@ public EffectiveNetworkSecurityGroup()
6668
[JsonProperty(PropertyName = "effectiveSecurityRules")]
6769
public IList<EffectiveNetworkSecurityRule> EffectiveSecurityRules { get; set; }
6870

71+
/// <summary>
72+
/// Gets or sets the tag map.
73+
/// </summary>
74+
[JsonProperty(PropertyName = "tagMap")]
75+
public IDictionary<string, List<string>> TagMap { get; set; }
6976
}
7077
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
4-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.8" targetFramework="net452" />
3+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
4+
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
55
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
66
</packages>

src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<HintPath>..\..\packages\Microsoft.Azure.Management.Resources.2.20.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
71+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

src/Common/Commands.Common.Storage/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
1111
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
1212
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
13-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
13+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
1414
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.0" targetFramework="net45" />
1515
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1616
<package id="Microsoft.WindowsAzure.Management.Storage" version="6.0.0" targetFramework="net45" />

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ protected void LogQosEvent()
522522

523523
try
524524
{
525+
_metricHelper.SetPSHost(this.Host);
525526
_metricHelper.LogQoSEvent(_qosEvent, IsUsageMetricEnabled, IsErrorMetricEnabled);
526527
_metricHelper.FlushMetric();
527528
WriteDebug("Finish sending metric.");

src/Common/Commands.Common/Commands.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.9\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
70+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7171
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

src/Common/Commands.Common/MetricHelper.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System;
2323
using System.Collections.Generic;
2424
using System.Diagnostics;
25+
using System.Management.Automation.Host;
2526
using System.Security.Cryptography;
2627
using System.Text;
2728

@@ -31,6 +32,8 @@ public class MetricHelper
3132
{
3233
protected INetworkHelper _networkHelper;
3334
private const int FlushTimeoutInMilli = 5000;
35+
private const string DefaultPSVersion = "3.0.0.0";
36+
private const string EventName = "cmdletInvocation";
3437

3538
/// <summary>
3639
/// The collection of telemetry clients.
@@ -58,6 +61,26 @@ public class MetricHelper
5861

5962
private AzurePSDataCollectionProfile _profile;
6063

64+
private static PSHost _host;
65+
66+
private static string _psVersion;
67+
68+
protected string PSVersion
69+
{
70+
get
71+
{
72+
if (_host != null)
73+
{
74+
_psVersion = _host.Version.ToString();
75+
}
76+
else
77+
{
78+
_psVersion = DefaultPSVersion;
79+
}
80+
return _psVersion;
81+
}
82+
}
83+
6184
public string HashMacAddress
6285
{
6386
get
@@ -171,7 +194,7 @@ private void LogUsageEvent(AzurePSQoSEvent qos)
171194
{
172195
var pageViewTelemetry = new PageViewTelemetry
173196
{
174-
Name = qos.CommandName ?? "empty",
197+
Name = EventName,
175198
Duration = qos.Duration,
176199
Timestamp = qos.StartTime
177200
};
@@ -217,13 +240,19 @@ private void LoadTelemetryClientContext(AzurePSQoSEvent qos, TelemetryContext cl
217240
}
218241
}
219242

243+
public void SetPSHost(PSHost host)
244+
{
245+
_host = host;
246+
}
247+
220248
private void PopulatePropertiesFromQos(AzurePSQoSEvent qos, IDictionary<string, string> eventProperties)
221249
{
222250
if (qos == null)
223251
{
224252
return;
225253
}
226254

255+
eventProperties.Add("Command", qos.CommandName);
227256
eventProperties.Add("IsSuccess", qos.IsSuccess.ToString());
228257
eventProperties.Add("ModuleName", qos.ModuleName);
229258
eventProperties.Add("ModuleVersion", qos.ModuleVersion);
@@ -234,6 +263,8 @@ private void PopulatePropertiesFromQos(AzurePSQoSEvent qos, IDictionary<string,
234263
eventProperties.Add("x-ms-client-request-id", qos.ClientRequestId);
235264
eventProperties.Add("UserAgent", AzurePowerShell.UserAgentValue.ToString());
236265
eventProperties.Add("HashMacAddress", HashMacAddress);
266+
eventProperties.Add("PowerShellVersion", PSVersion);
267+
eventProperties.Add("Version", AzurePowerShell.AssemblyVersion);
237268
if (qos.InputFromPipeline != null)
238269
{
239270
eventProperties.Add("InputFromPipeline", qos.InputFromPipeline.Value.ToString());

src/Common/Commands.Common/Utilities/GeneralUtilities.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,28 @@ public static void EnsureDefaultProfileDirectoryExists()
430430
}
431431
}
432432

433+
/// <summary>
434+
/// Checks if collection has more than one element
435+
/// </summary>
436+
/// <typeparam name="T">Type of the collection.</typeparam>
437+
/// <param name="collection">Collection.</param>
438+
/// <returns></returns>
439+
public static bool HasMoreThanOneElement<T>(ICollection<T> collection)
440+
{
441+
return collection != null && collection.Count > 1;
442+
}
443+
444+
/// <summary>
445+
/// Checks if collection has only one element
446+
/// </summary>
447+
/// <typeparam name="T">Type of the collection.</typeparam>
448+
/// <param name="collection">Collection.</param>
449+
/// <returns></returns>
450+
public static bool HasSingleElement<T>(ICollection<T> collection)
451+
{
452+
return collection != null && collection.Count == 1;
453+
}
454+
433455
/// <summary>
434456
/// Clear the current storage account from the context - guarantees that only one storage account will be active
435457
/// at a time.

src/Common/Commands.Common/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
1010
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
1111
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
12-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.9" targetFramework="net452" />
12+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
1313
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1414
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1515
</packages>

0 commit comments

Comments
 (0)