Skip to content

Commit 5186615

Browse files
amolramolr
authored andcommitted
Merge branch 'preview' of https://github.com/Azure/azure-powershell into preview
2 parents b3098e2 + b7d4410 commit 5186615

File tree

320 files changed

+545747
-27703
lines changed

Some content is hidden

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

320 files changed

+545747
-27703
lines changed

documentation/release-notes/migration-guide.4.0.0.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This document serves as both a breaking change notification and migration guide
77
- [Breaking changes to Compute cmdlets](#breaking-changes-to-compute-cmdlets)
88
- [Breaking changes to EventHub cmdlets](#breaking-changes-to-eventhub-cmdlets)
99
- [Breaking changes to Insights cmdlets](#breaking-changes-to-insights-cmdlets)
10+
- [Breaking changes to Network cmdlets](#breaking-changes-to-network-cmdlets)
1011
- [Breaking changes to ServiceBus cmdlets](#breaking-changes-to-servicebus-cmdlets)
1112
- [Breaking changes to Sql cmdlets](#breaking-changes-to-sql-cmdlets)
1213
- [Breaking changes to Storage cmdlets](#breaking-changes-to-storage-cmdlets)
@@ -171,6 +172,21 @@ Set-AzureRmDiagnosticSettings
171172
Update-AzureRmDiagnosticSettings
172173
```
173174

175+
## Breaking changes to Network cmdlets
176+
177+
The following cmdlets were affected this release:
178+
179+
### New-AzureRmVirtualNetworkGatewayConnection
180+
- `EnableBgp` parameter has been changed to take a `boolean` instead of a `string`
181+
182+
```powershell
183+
# Old
184+
New-AzureRmVirtualNetworkGatewayConnection -ResourceGroupName "RG" -name "conn1" -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -SharedKey "key" -EnableBgp "true"
185+
186+
# New
187+
New-AzureRmVirtualNetworkGatewayConnection -ResourceGroupName "RG" -name "conn1" -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -SharedKey "key" -EnableBgp $true
188+
```
189+
174190
## Breaking changes to ServiceBus cmdlets
175191

176192
The following cmdlets were affected this release:

src/Common/Commands.Common/Extensions/CmdletExtensions.cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
using System.Collections.Generic;
1717
using System.Collections.ObjectModel;
1818
using System.IO;
19+
using System.Linq;
1920
using System.Management.Automation;
21+
using System.Management.Automation.Runspaces;
2022
using System.Reflection;
23+
using System.Text;
2124

2225
namespace Microsoft.WindowsAzure.Commands.Utilities.Common
2326
{
@@ -64,6 +67,80 @@ public static string ResolvePath(this PSCmdlet psCmdlet, string path)
6467
return fullPath;
6568
}
6669

70+
/// <summary>
71+
/// Execute the given cmdlet in powershell usign the given pipeline parameters.
72+
/// </summary>
73+
/// <typeparam name="T">The output type for the cmdlet</typeparam>
74+
/// <param name="cmdlet">The cmdlet to execute</param>
75+
/// <param name="name">The name of the cmdlet</param>
76+
/// <param name="cmdletParameters">The parameters to pass to the cmdlet on the pipeline</param>
77+
/// <returns>The output of executing the cmdlet</returns>
78+
public static List<T> ExecuteCmdletInPipeline<T>(this PSCmdlet cmdlet, string name, params object[] cmdletParameters)
79+
{
80+
List<T> output = new List<T>();
81+
using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
82+
{
83+
var info = new CmdletInfo(name, cmdlet.GetType());
84+
Collection<T> result = powershell.AddCommand(info).Invoke<T>(cmdletParameters);
85+
if (powershell.Streams.Error != null && powershell.Streams.Error.Count > 0)
86+
{
87+
StringBuilder details = new StringBuilder();
88+
powershell.Streams.Error.ForEach(e => details.AppendFormat("Error: {0}\n", e.ToString()));
89+
throw new InvalidOperationException(string.Format("Errors while running cmdlet:\n {0}", details.ToString()));
90+
}
91+
92+
if (result != null && result.Count > 0)
93+
{
94+
result.ForEach(output.Add);
95+
}
96+
}
97+
98+
return output;
99+
}
100+
101+
/// <summary>
102+
/// Execute the given cmdlet in powershell with the given parameters after injecting the given exception. It is expected that the cmdlet has a runtime that can be used for receiving output
103+
/// </summary>
104+
/// <typeparam name="T"></typeparam>
105+
/// <param name="cmdlet">The cmdlet to execute</param>
106+
/// <param name="name">The name of the cmdlet</param>
107+
/// <param name="exception">The exception to inject into the error stream</param>
108+
/// <param name="cmdletParameters">The parameters to pass to the cmdlet on the pipeline</param>
109+
public static void ExecuteCmdletWithExceptionInPipeline<T>(this PSCmdlet cmdlet, string name, Exception exception, params KeyValuePair<string, object>[] cmdletParameters)
110+
{
111+
List<T> output = new List<T>();
112+
using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
113+
{
114+
var info = new CmdletInfo(name, cmdlet.GetType());
115+
powershell.AddCommand("Write-Error");
116+
powershell.AddParameter("Exception", exception);
117+
powershell.Invoke();
118+
powershell.Commands.Clear();
119+
powershell.AddCommand(info);
120+
foreach (var pair in cmdletParameters)
121+
{
122+
if (pair.Value == null)
123+
{
124+
powershell.AddParameter(pair.Key);
125+
}
126+
else
127+
{
128+
powershell.AddParameter(pair.Key, pair.Value);
129+
}
130+
}
131+
Collection<T> result = powershell.Invoke<T>();
132+
powershell.Streams.Error.ForEach(cmdlet.WriteError);
133+
powershell.Streams.Debug.ForEach(d => cmdlet.WriteDebug(d.Message));
134+
powershell.Streams.Verbose.ForEach(v => cmdlet.WriteWarning(v.Message));
135+
powershell.Streams.Warning.ForEach(w => cmdlet.WriteWarning(w.Message));
136+
137+
if (result != null && result.Count > 0)
138+
{
139+
result.ForEach(r => cmdlet.WriteObject(r));
140+
}
141+
}
142+
}
143+
67144
public static List<T> ExecuteScript<T>(this PSCmdlet cmdlet, string contents)
68145
{
69146
List<T> output = new List<T>();

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ public class NewAzureCognitiveServicesAccountCommand : CognitiveServicesAccountB
7373
[Parameter(
7474
Mandatory = false,
7575
HelpMessage = "Cognitive Services Account Tags.")]
76-
[Alias (TagsAlias)]
76+
[Alias(TagsAlias)]
7777
[ValidateNotNull]
7878
[AllowEmptyCollection]
7979
public Hashtable[] Tag { get; set; }
80-
80+
8181
[Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")]
8282
public SwitchParameter Force { get; set; }
83-
83+
8484
public override void ExecuteCmdlet()
8585
{
8686
base.ExecuteCmdlet();
@@ -97,10 +97,20 @@ public override void ExecuteCmdlet()
9797
};
9898

9999
if (ShouldProcess(
100-
this.Name, string.Format(CultureInfo.CurrentCulture, Resources.NewAccount_ProcessMessage, this.Name, this.Type, this.SkuName, this.Location))
101-
||
102-
Force.IsPresent)
100+
this.Name, string.Format(CultureInfo.CurrentCulture, Resources.NewAccount_ProcessMessage, this.Name, this.Type, this.SkuName, this.Location)))
103101
{
102+
if (Force.IsPresent)
103+
{
104+
WriteWarning(Resources.NewAccount_Notice);
105+
}
106+
else
107+
{
108+
bool yesToAll = false, noToAll = false;
109+
if (!ShouldContinue(Resources.NewAccount_Notice, "Notice", true, ref yesToAll, ref noToAll))
110+
{
111+
return;
112+
}
113+
}
104114

105115
var createAccountResponse = this.CognitiveServicesClient.CognitiveServicesAccounts.Create(
106116
this.ResourceGroupName,

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/Properties/Resources.Designer.cs

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

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<data name="NewAccountKey_ProcessMessage" xml:space="preserve">
121121
<value>Regenerating Key {0} for account {1}.</value>
122122
</data>
123+
<data name="NewAccount_Notice" xml:space="preserve">
124+
<value>Microsoft will use data you send to the Cognitive Services to improve Microsoft products and services. Where you send personal data to the Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to the Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account).</value>
125+
</data>
123126
<data name="NewAccount_ProcessMessage" xml:space="preserve">
124127
<value>Creating new Cognitive Services account {0} of type {1}, Sku {2} at location {3}.</value>
125128
</data>

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/PSCmdletExtensions.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System;
1616
using System.Management.Automation;
1717
using System.Reflection;
18+
using System.Threading;
1819

1920
namespace Microsoft.WindowsAzure.Commands.ScenarioTest
2021
{
@@ -46,6 +47,17 @@ public static void ExecuteCmdlet(this PSCmdlet cmdlet)
4647
throw e.InnerException;
4748
}
4849
}
50+
public static void ExecuteCommand(this PSCmdlet cmdlet)
51+
{
52+
try
53+
{
54+
GetProtectedMethod("ProcessRecord").Invoke(cmdlet, new object[] { });
55+
}
56+
catch (TargetInvocationException e)
57+
{
58+
throw e.InnerException;
59+
}
60+
}
4961

5062
public static void SetCommandRuntimeMock(this PSCmdlet cmdlet, ICommandRuntime value)
5163
{

src/ResourceManager/Compute/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Updated Set-AzureRmVMAEMExtension: Add caching information for Premium managed disks
2122

2223
## Version 3.0.0
2324
* Updated Set-AzureRmVMAEMExtension and Test-AzureRmVMAEMExtension cmdlets to support Premium managed disks
@@ -93,4 +94,4 @@
9394
- VMScaleSet and ContainerService now have "ResourceGroupName" property, so when piping Get command to Delete/Update command, -ResourceGroupName is not required.
9495
* Separate paremater sets for Set-AzureRmVM with Generalized and Redeploy parameter
9596
* Reduce time taken by Get-AzureRmVMDiskEncryptionStatus cmdlet from two minutes to under five seconds
96-
* Allow Set-AzureRmVMDiskEncryptionStatus to be used with VHDs residing in multiple resource groups
97+
* Allow Set-AzureRmVMDiskEncryptionStatus to be used with VHDs residing in multiple resource groups

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AEMExtensionTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ function Test-AEMExtensionAdvancedWindowsMD
284284
Assert-AreEqual $extension.Name 'AzureCATExtensionHandler'
285285
$settings = $extension.PublicSettings | ConvertFrom-Json
286286
Assert-NotNull $settings.cfg
287+
Assert-True { ($extension.PublicSettings.Contains("osdisk.caching")) }
287288
Write-Verbose "Test-AEMExtensionAdvancedWindowsMD: Get done"
288289

289290
# Test command.

0 commit comments

Comments
 (0)