Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/ResourceManager/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Current Release
* Fix issue with `Properties` property of `PSResource` object(s) returned from `Get-AzureRmResource`

## Version 6.0.0
* Set minimum dependency of module to PowerShell 5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkExtensions;
using Microsoft.Azure.Management.ResourceManager.Models;
using Newtonsoft.Json.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels
{
Expand All @@ -40,7 +43,7 @@ public class PSResource

public Plan Plan { get; set; }

public object Properties { get; set; }
public PSObject Properties { get; set; }

public string ResourceGroupName { get; set; }

Expand All @@ -62,7 +65,7 @@ public PSResource(GenericResource resource)
this.ManagedBy = resource.ManagedBy;
this.Name = resource.Name;
this.Plan = resource.Plan;
this.Properties = resource.Properties;
this.Properties = ((JToken)resource.Properties).ToPsObject();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Also, argh PowerShell, haha.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is it ever possible for resource.Properties to not be convertible to JToken?

this.ResourceType = resource.Type;
this.Sku = resource.Sku;
this.Tags = resource.Tags;
Expand Down
3 changes: 2 additions & 1 deletion tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
"AssemblyFileName","ClassName","Target","Severity","ProblemId","Description","Remediation"
"AssemblyFileName","ClassName","Target","Severity","ProblemId","Description","Remediation"
"Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResourceCmdlet","Get-AzureRmResource","0","3000","The type of property 'Properties' of type 'Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResource' has changed from 'System.Object' to 'System.Management.Automation.PSObject'.","Change the type of property 'Properties' back to 'System.Object'."