Skip to content

Commit 39ca73d

Browse files
committed
Merge branch 'preview' of github.com:Azure/azure-powershell into static-analysis-rules
# Conflicts: # tools/StaticAnalysis/Exceptions/SignatureIssues.csv
2 parents 55ca43f + ca5a272 commit 39ca73d

File tree

138 files changed

+10304
-7019
lines changed

Some content is hidden

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

138 files changed

+10304
-7019
lines changed

LICENSE.txt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,25 +184,44 @@ BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT
184184
incurred by, or claims asserted against, such Contributor by reason
185185
of your accepting any such warranty or additional liability.
186186

187-
-------------------END OF LICENSE-------------------------------
187+
-------------------END OF LICENSE------------------------------------------
188188

189-
The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software.
190189

191-
----------------START OF LICENSE--------------------------------
190+
----------------START OF THIRD PARTY NOTICE--------------------------------
191+
192+
193+
The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software.
192194

193195
Provided for Informational Purposes Only
194196

195197
AutoMapper
196198

197199
The MIT License (MIT)
198-
199200
Copyright (c) 2010 Jimmy Bogard
200201

202+
201203
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
202204

203205
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
204206

205207
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
206208

207-
-------------END OF LICENSE----------------------------------------
209+
210+
211+
212+
213+
214+
***************
215+
216+
The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software.
217+
218+
Newtonsoft.Json
219+
220+
The MIT License (MIT)
221+
Copyright (c) 2007 James Newton-King
222+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
223+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
224+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
225+
226+
-------------END OF THIRD PARTY NOTICE----------------------------------------
208227

documentation/development-docs/azure-powershell-design-guidelines.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ $job | Wait-Job
269269
$subcriptions = $job | Receive-Job
270270
````
271271

272+
To set a custom job name, please use [SetBackgroupJobDescription(string name)](https://github.com/Azure/azure-powershell/blob/preview/src/Common/Commands.Common/AzurePSCmdlet.cs#L761). The default job description is: "Long Running Operation for '{cmdlet name}' on resource '{resource name}'"
273+
272274
## Argument Completers
273275

274276
PowerShell uses Argument Completers to provide tab completion for users. At the moment, Azure PowerShell has two specific argument completers that should be applied to relevant parameters, and one generic argument completer that can be used to tab complete with a given list of values.
@@ -307,4 +309,4 @@ using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
307309
[Parameter(Mandatory = false, HelpMessage = "The tiers of the plan")]
308310
[PSArgumentCompleter("Basic", "Premium", "Elite")]
309311
public string Tier { get; set; }
310-
```
312+
```

setup/media/License.rtf

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{\rtf1\ansi\ansicpg936\deff0\nouicompat\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
2-
{\colortbl ;\red0\green0\blue255;}
3-
{\*\generator Riched20 6.3.9600}\viewkind4\uc1
4-
\pard\sl240\slmult1\f0\fs20\lang9 MICROSOFT SOFTWARE LICENSE TERMS\par
1+
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}}
2+
{\colortbl ;\red0\green0\blue255;\red36\green41\blue46;}
3+
{\*\generator Riched20 10.0.16299}{\*\mmathPr\mnaryLim0\mdispDef1\mwrapIndent1440 }\viewkind4\uc1
4+
\pard\nowidctlpar\f0\fs20\lang9 MICROSOFT SOFTWARE LICENSE TERMS\par
55
\par
66
MICROSOFT AZURE POWERSHELL \par
77
\par
@@ -187,27 +187,49 @@ BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT
187187
incurred by, or claims asserted against, such Contributor by reason\par
188188
of your accepting any such warranty or additional liability.\par
189189
\par
190-
-------------------END OF LICENSE-------------------------------\par
190+
-------------------END OF LICENSE------------------------------------------\par
191191
\par
192-
The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software.\par
193192
\par
194-
----------------START OF LICENSE--------------------------------\par
193+
----------------START OF THIRD PARTY NOTICE--------------------------------\par
194+
\par
195+
\par
196+
The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software.\par
195197
\par
196198
Provided for Informational Purposes Only\par
197199
\par
198200
AutoMapper\par
199201
\par
200202
The MIT License (MIT)\par
201-
\par
202203
Copyright (c) 2010 Jimmy Bogard\par
203204
\par
205+
\par
204206
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\par
205207
\par
206208
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\par
207209
\par
208210
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\par
209211
\par
210-
-------------END OF LICENSE----------------------------------------\par
212+
\par
213+
\par
214+
\par
215+
\par
216+
\par
217+
***************\par
218+
\par
219+
The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software.\par
220+
\par
221+
Newtonsoft.Json\par
222+
\par
223+
224+
\pard\widctlpar\sa240\cf2\lang1033 The MIT License (MIT)\par
225+
Copyright (c) 2007 James Newton-King\par
226+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\par
227+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\par
228+
229+
\pard\widctlpar THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\par
230+
231+
\pard\nowidctlpar\cf0\lang9\par
232+
-------------END OF THIRD PARTY NOTICE----------------------------------------\par
211233
\par
212234
}
213-
235+

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
1919
using Microsoft.Azure.ServiceManagemenet.Common.Models;
2020
using Microsoft.WindowsAzure.Commands.Common;
21+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2122
using System;
2223
using System.Collections.Concurrent;
2324
using System.Diagnostics;
@@ -688,22 +689,78 @@ protected override void ProcessRecord()
688689
}
689690
}
690691

692+
private string _implementationBackgroundJobDescription;
693+
691694
/// <summary>
692695
/// Job Name paroperty iof this cmdlet is run as a job
693696
/// </summary>
694697
public virtual string ImplementationBackgroundJobDescription
695698
{
696699
get
697700
{
698-
string name = "Long Running Azure Operation";
699-
string commandName = MyInvocation?.MyCommand?.Name;
700-
if (!string.IsNullOrWhiteSpace(commandName))
701+
if (_implementationBackgroundJobDescription != null)
701702
{
702-
name = string.Format("Long Running Operation for '{0}'", commandName);
703+
return _implementationBackgroundJobDescription;
703704
}
705+
else
706+
{
707+
string name = "Long Running Azure Operation";
708+
string commandName = MyInvocation?.MyCommand?.Name;
709+
string objectName = null;
710+
if (this.IsBound("Name"))
711+
{
712+
objectName = MyInvocation.BoundParameters["Name"].ToString();
713+
}
714+
else if (this.IsBound("InputObject") == true)
715+
{
716+
var type = MyInvocation.BoundParameters["InputObject"].GetType();
717+
var inputObject = Convert.ChangeType(MyInvocation.BoundParameters["InputObject"], type);
718+
if (type.GetProperty("Name") != null)
719+
{
720+
objectName = inputObject.GetType().GetProperty("Name").GetValue(inputObject).ToString();
721+
}
722+
else if (type.GetProperty("ResourceId") != null)
723+
{
724+
string[] tokens = inputObject.GetType().GetProperty("ResourceId").GetValue(inputObject).ToString().Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
725+
if (tokens.Length >= 8)
726+
{
727+
objectName = tokens[tokens.Length - 1];
728+
}
729+
}
730+
}
731+
else if (this.IsBound("ResourceId") == true)
732+
{
733+
string[] tokens = MyInvocation.BoundParameters["ResourceId"].ToString().Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
734+
if (tokens.Length >= 8)
735+
{
736+
objectName = tokens[tokens.Length - 1];
737+
}
738+
}
739+
740+
if (!string.IsNullOrWhiteSpace(commandName))
741+
{
742+
if (!string.IsNullOrWhiteSpace(objectName))
743+
{
744+
name = string.Format("Long Running Operation for '{0}' on resource '{1}'", commandName, objectName);
745+
}
746+
else
747+
{
748+
name = string.Format("Long Running Operation for '{0}'", commandName);
749+
}
750+
}
704751

705-
return name;
752+
return name;
753+
}
706754
}
755+
set
756+
{
757+
_implementationBackgroundJobDescription = value;
758+
}
759+
}
760+
761+
public void SetBackgroundJobDescription(string jobName)
762+
{
763+
ImplementationBackgroundJobDescription = jobName;
707764
}
708765

709766
protected virtual void Dispose(bool disposing)

src/ResourceManager/Aks/Commands.Aks.Test/ScenarioTests/KubernetesTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ public KubernetesTests(ITestOutputHelper output)
1515
TestExecutionHelpers.SetUpSessionAndProfile();
1616
}
1717

18-
[Fact(Skip = "Need service team to re-record test after changes to the ClientRuntime.")]
18+
[Fact]
1919
[Trait(Category.AcceptanceType, Category.CheckIn)]
20-
[Trait("Re-record", "ClientRuntime changes")]
2120
public void TestAzureKubernetes()
2221
{
2322
TestController.NewInstance.RunPowerShellTest("Test-AzureRmKubernetes");

src/ResourceManager/Aks/Commands.Aks.Test/ScenarioTests/TestController.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,27 @@ public void RunPowerShellTest(params string[] scripts)
7474
string jsonOutput = @"{""" + subscription + @""":{ ""service_principal"":""foo"",""client_secret"":""bar""}}";
7575
AzureSession.Instance.DataStore.WriteFile(Path.Combine(home, ".azure", "acsServicePrincipal.json"), jsonOutput);
7676
}
77+
else if (HttpMockServer.GetCurrentMode() == HttpRecorderMode.Record)
78+
{
79+
AzureSession.Instance.DataStore = new MemoryDataStore();
80+
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
81+
var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath);
82+
var subscription = HttpMockServer.Variables["SubscriptionId"];
83+
var currentEnvironment = TestEnvironmentFactory.GetTestEnvironment();
84+
string spn = null;
85+
string spnSecret = null;
86+
if (currentEnvironment.ConnectionString.KeyValuePairs.ContainsKey("ServicePrincipal"))
87+
{
88+
spn = currentEnvironment.ConnectionString.KeyValuePairs["ServicePrincipal"];
89+
}
90+
if (currentEnvironment.ConnectionString.KeyValuePairs.ContainsKey("ServicePrincipalSecret"))
91+
{
92+
spnSecret = currentEnvironment.ConnectionString.KeyValuePairs["ServicePrincipalSecret"];
93+
}
94+
AzureSession.Instance.DataStore.WriteFile(Path.Combine(home, ".ssh", "id_rsa.pub"), File.ReadAllText(dir + "/Fixtures/id_rsa.pub"));
95+
string jsonOutput = @"{""" + subscription + @""":{ ""service_principal"":""" + spn + @""",""client_secret"":"""+ spnSecret + @"""}}";
96+
AzureSession.Instance.DataStore.WriteFile(Path.Combine(home, ".azure", "acsServicePrincipal.json"), jsonOutput);
97+
}
7798

7899
helper.RunPowerShellTest(scripts);
79100
}

src/ResourceManager/Aks/Commands.Aks.Test/SessionRecords/Commands.Aks.Test.ScenarioTests.KubernetesTests/TestAzureKubernetes.json

Lines changed: 1132 additions & 3307 deletions
Large diffs are not rendered by default.

src/ResourceManager/AzureBatch/AzureRM.Batch.Netcore.psd1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ CmdletsToExport = 'Remove-AzureRmBatchAccount', 'Get-AzureRmBatchAccount',
107107
'New-AzureBatchComputeNodeUser', 'Remove-AzureBatchComputeNodeUser',
108108
'Enable-AzureBatchTask', 'Set-AzureBatchTask', 'Stop-AzureBatchTask',
109109
'Get-AzureBatchComputeNode', 'Get-AzureBatchJobSchedule',
110-
'New-AzureBatchJobSchedule', 'Remove-AzureBatchJobSchedule',
111-
'Get-AzureBatchTaskCounts'
110+
'New-AzureBatchJobSchedule', 'Remove-AzureBatchJobSchedule',
111+
'Get-AzureBatchTaskCounts', 'Get-AzureBatchPoolNodeCounts',
112+
'Start-AzureBatchComputeNodeServiceLogUpload'
112113

113114
# Variables to export from this module
114115
# VariablesToExport = @()

src/ResourceManager/AzureBatch/AzureRM.Batch.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ CmdletsToExport = 'Remove-AzureRmBatchAccount', 'Get-AzureRmBatchAccount',
111111
'Enable-AzureBatchTask', 'Set-AzureBatchTask', 'Stop-AzureBatchTask',
112112
'Get-AzureBatchComputeNode', 'Get-AzureBatchJobSchedule',
113113
'New-AzureBatchJobSchedule', 'Remove-AzureBatchJobSchedule',
114-
'Get-AzureBatchTaskCounts'
114+
'Get-AzureBatchTaskCounts', 'Get-AzureBatchPoolNodeCounts',
115+
'Start-AzureBatchComputeNodeServiceLogUpload'
115116

116117
# Variables to export from this module
117118
# VariablesToExport = @()

src/ResourceManager/AzureBatch/BatchModelGenerator/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class Program
8484
{"Microsoft.Azure.Batch.NetworkConfiguration", "PSNetworkConfiguration"},
8585
{"Microsoft.Azure.Batch.NetworkSecurityGroupRule", "PSNetworkSecurityGroupRule"},
8686
{"Microsoft.Azure.Batch.NodeAgentSku", "PSNodeAgentSku"},
87+
{"Microsoft.Azure.Batch.NodeCounts", "PSNodeCounts"},
8788
{"Microsoft.Azure.Batch.NodeFile", "PSNodeFile"},
8889
{"Microsoft.Azure.Batch.OSDisk", "PSOSDisk"},
8990
{"Microsoft.Azure.Batch.OutputFile", "PSOutputFile"},
@@ -92,6 +93,7 @@ public class Program
9293
{"Microsoft.Azure.Batch.OutputFileBlobContainerDestination", "PSOutputFileBlobContainerDestination"},
9394
{"Microsoft.Azure.Batch.PoolEndpointConfiguration", "PSPoolEndpointConfiguration"},
9495
{"Microsoft.Azure.Batch.PoolInformation", "PSPoolInformation"},
96+
{"Microsoft.Azure.Batch.PoolNodeCounts", "PSPoolNodeCounts"},
9597
{"Microsoft.Azure.Batch.PoolSpecification", "PSPoolSpecification"},
9698
{"Microsoft.Azure.Batch.PoolStatistics", "PSPoolStatistics"},
9799
{"Microsoft.Azure.Batch.PoolUsageMetrics", "PSPoolUsageMetrics"},
@@ -114,6 +116,7 @@ public class Program
114116
{"Microsoft.Azure.Batch.TaskFailureInformation", "PSTaskFailureInformation"},
115117
{"Microsoft.Azure.Batch.TaskSchedulingPolicy", "PSTaskSchedulingPolicy"},
116118
{"Microsoft.Azure.Batch.TaskStatistics", "PSTaskStatistics"},
119+
{"Microsoft.Azure.Batch.UploadBatchServiceLogsResult", "PSStartComputeNodeServiceLogUploadResult"},
117120
{"Microsoft.Azure.Batch.UsageStatistics", "PSUsageStatistics"},
118121
{"Microsoft.Azure.Batch.UserAccount", "PSUserAccount"},
119122
{"Microsoft.Azure.Batch.UserIdentity", "PSUserIdentity"},

src/ResourceManager/AzureBatch/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Release new cmdlet Get-AzureBatchPoolNodeCounts
22+
* Release new cmdlet Start-AzureBatchComputeNodeServiceLogUpload
2123

2224
## Version 4.0.7
2325
* Set minimum dependency of module to PowerShell 5.0

0 commit comments

Comments
 (0)