Skip to content

Commit 197d347

Browse files
committed
Fix issue with Properties property of PSResource
1 parent 4be746e commit 197d347

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/ResourceManager/Resources/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Fix issue with `Properties` property of `PSResource` object(s) returned from `Get-AzureRmResource`
2122

2223
## Version 6.0.0
2324
* Set minimum dependency of module to PowerShell 5.0

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/SdkModels/Resources/PSResource.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
16+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
1617
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkExtensions;
1718
using Microsoft.Azure.Management.ResourceManager.Models;
19+
using Newtonsoft.Json.Linq;
1820
using System.Collections;
1921
using System.Collections.Generic;
22+
using System.Management.Automation;
2023

2124
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels
2225
{
@@ -40,7 +43,7 @@ public class PSResource
4043

4144
public Plan Plan { get; set; }
4245

43-
public object Properties { get; set; }
46+
public PSObject Properties { get; set; }
4447

4548
public string ResourceGroupName { get; set; }
4649

@@ -62,7 +65,7 @@ public PSResource(GenericResource resource)
6265
this.ManagedBy = resource.ManagedBy;
6366
this.Name = resource.Name;
6467
this.Plan = resource.Plan;
65-
this.Properties = resource.Properties;
68+
this.Properties = ((JToken)resource.Properties).ToPsObject();
6669
this.ResourceType = resource.Type;
6770
this.Sku = resource.Sku;
6871
this.Tags = resource.Tags;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
"AssemblyFileName","ClassName","Target","Severity","ProblemId","Description","Remediation"
1+
"AssemblyFileName","ClassName","Target","Severity","ProblemId","Description","Remediation"
2+
"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'."

0 commit comments

Comments
 (0)