Skip to content

[Resources] Bug fixes for deployment and deployment What-If cmdlets #12780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Resources/ResourceManager/Comparers/ChangeTypeComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class ChangeTypeComparer : IComparer<ChangeType>
[ChangeType.Create] = 1,
[ChangeType.Deploy] = 2,
[ChangeType.Modify] = 3,
[ChangeType.Ignore] = 4,
[ChangeType.NoChange] = 5,
[ChangeType.NoChange] = 4,
[ChangeType.Ignore] = 5,
};

public int Compare(ChangeType first, ChangeType second)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Formatters
using System;
using System.Collections.Generic;

public class PSResourceManagerErrorFormatter
public static class PSResourceManagerErrorFormatter
{
public static string Format(PSResourceManagerError error)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Rest.Azure;
using Microsoft.Rest.Azure.OData;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProjectResources = Microsoft.Azure.Commands.ResourceManager.Cmdlets.Properties.Resources;
using ProvisioningState = Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ProvisioningState;
Expand Down Expand Up @@ -451,8 +453,10 @@ private Deployment CreateBasicDeployment(PSDeploymentCmdletParameters parameters
}
else
{
string parametersContent = parameters.TemplateParameterObject != null
? PSJsonSerializer.Serialize(parameters.TemplateParameterObject)
// ToDictionary is needed for extracting value from a secure string. Do not remove it.
Dictionary<string, object> parametersDictionary = parameters.TemplateParameterObject?.ToDictionary(false);
string parametersContent = parametersDictionary != null
? PSJsonSerializer.Serialize(parametersDictionary)
: null;
deployment.Properties.Parameters = !string.IsNullOrEmpty(parametersContent)
? JObject.Parse(parametersContent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Commands.Common.Authentication.Abstractions;
using Management.ResourceManager.Models;
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Json;
using Microsoft.WindowsAzure.Commands.Common;
using Newtonsoft.Json.Linq;

public class PSDeploymentWhatIfCmdletParameters
Expand Down Expand Up @@ -105,8 +106,10 @@ public DeploymentWhatIf ToDeploymentWhatIf()
}
else
{
string parametersContent = this.TemplateParametersObject != null
? PSJsonSerializer.Serialize(this.TemplateParametersObject)
// ToDictionary is needed for extracting value from a secure string. Do not remove it.
Dictionary<string, object> parametersDictionary = this.TemplateParametersObject?.ToDictionary(false);
string parametersContent = parametersDictionary != null
? PSJsonSerializer.Serialize(parametersDictionary)
: null;
properties.Parameters = !string.IsNullOrEmpty(parametersContent)
? JObject.Parse(parametersContent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ public void Format_ResourceIdOnly_SortsAndGroupsByShortResourceId()
- p5/foo
- p6/foo{Color.Reset}{Color.Green}
+ p2/foo{Color.Reset}{Color.Blue}
! p4/foo{Color.Reset}{Color.Gray}
* p1/foo{Color.Reset}{Color.Reset}
= p3/foo
! p4/foo{Color.Reset}{Color.Reset}
= p3/foo{Color.Reset}{Color.Gray}
* p1/foo
{Color.Reset}
"
.Replace("\r\n", Environment.NewLine);
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
-->
## Upcoming Release
* Added breaking change attribute to `SubscriptionId` parameter of `Get-AzResourceGroupDeploymentOperation`.
* Updated ARM template What-If cmdlets to show "Ignore" resource changes last.
* Fixed an issue where dynamic secure string parameters for deployment cmdlets are not correctly serialized.

## Version 2.5.0
* Updated `Get-AzPolicyAlias` response to include information indicating whether the alias is modifiable by Azure Policy.
Expand Down