Skip to content
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

Get-AzPolicyAssignment has problems with policy name containing an ampersand & #26790

Open
powershellpr0mpt opened this issue Nov 29, 2024 · 2 comments
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Policy Azure Resource Policy Service Attention This issue is responsible by Azure service team.

Comments

@powershellpr0mpt
Copy link

powershellpr0mpt commented Nov 29, 2024

Description

We have a customer that has subscriptions containing a &.
We construct a policy assignment name with tag - subscriptionname

So for example Critical - Hewlett & Packard - Development

If I want to check if a policy assignment with that name already exists, I would simply use Get-AzPolicyAssignment to check if the assignment exists or not.

Unfortunately the cmdlet doesn't seem to like & signs and throws up code:

Get-AzPolicyAssignment -Name 'Critical - Hewlett & Packard - Development' -Scope '/subscriptions/00000000-0000-0000-0000-000000000' -ErrorAction Stop

Get-AzPolicyAssignment_Get: C:\bgates\PowerShell\Modules\Az.Resources\7.4.0\Policy.Autorest\custom\Get-AzPolicyAssignment.ps1:250:19
Line |
250 |      $scriptCmd = {& $wrappedCmd @calledParameters}
     |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Expected literal (number, boolean, or null). Was '<'.

Have tried this on various versions of the module, but problem still exists.
Ran this on my colleagues machine, but also in a 7.2 clean Automation Account using 'default' latest version of the modules.

When trying the same thing manually, using the exact same name in the Portal, it does work just fine, both getting the info and creating/editing a policy assignment.

Issue script & Debug output

$DebugPreference='Continue'
Get-AzPolicyAssignment -Name 'Critical - Hewlett & Packard - Development' -Scope '/subscriptions/00000000-0000-0000-0000-000000000' -ErrorAction Stop

DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing: 
DEBUG: CmdletProcessRecordStart: 
DEBUG: CmdletGetPipeline: 
DEBUG: CmdletBeforeAPICall: 
DEBUG: URLCreated: //subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.Authorization/policyAssignments/Critical-%20-%20Hewlett%20%26%20Packard?api-version=2023-04-01
DEBUG: RequestCreated: //subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.Authorization/policyAssignments/Critical%20-%20Hewlett%20%26%20Packard?api-version=2023-04-01
DEBUG: HeaderParametersAdded: 
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com//subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.Authorization/policyAssignments/Critical - Hewlett %26 Packard?api-version=2023-04-01

Headers:
x-ms-unique-id                : 2
x-ms-client-request-id        : 6e92565f-67a7-4259-abf8-cccef5f9cef0
CommandName                   : &
FullCommandName               : Get-AzPolicyAssignment_Get
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v12.1.0,PSVersion/v7.4.6,Az.Policy/7.4.0

Body:



DEBUG: BeforeCall: 
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Cache-Control                 : private
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: 381A61676B6440559FE2E19D4C681346 Ref B: AMS231032608035 Ref C: 2024-11-29T13:45:50Z
Date                          : Fri, 29 Nov 2024 13:45:49 GMT

Body:
<!DOCTYPE html>
<html>
    <head>
        <title>Runtime Error</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:pointer; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>Runtime Error</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
            <br><br>

            <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

&lt;!-- Web.Config Configuration File --&gt;

&lt;configuration&gt;
    &lt;system.web&gt;
        &lt;customErrors mode=&quot;Off&quot;/&gt;
    &lt;/system.web&gt;
&lt;/configuration&gt;</pre>                      </code>

                  </td>
               </tr>
            </table>

            <br>

            <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application&#39;s &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br>  

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

&lt;!-- Web.Config Configuration File --&gt;

&lt;configuration&gt;
    &lt;system.web&gt;
        &lt;customErrors mode=&quot;RemoteOnly&quot; defaultRedirect=&quot;mycustompage.htm&quot;/&gt;
    &lt;/system.web&gt;
&lt;/configuration&gt;</pre>                      </code>

                  </td>
               </tr>
            </table>

            <br>

            </font>

    </body>
</html>



DEBUG: ResponseCreated: 
DEBUG: BeforeResponseDispatch: 
DEBUG: [Finally]: Cannot deserialize due to Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally: 
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd: 
DEBUG: [CmdletException]: Received Exception with message 'ParserException - Expected literal (number, boolean, or null). Was '<'. :    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadIdentifer()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadLiteral()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadNext()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.TokenReader.Next()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonParser..ctor(SourceReader sourceReader)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(SourceReader sourceReader)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(String text)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.<>c.<PolicyAssignmentsGet_Call>b__44_1(Task`1 body)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.onDefault(HttpResponseMessage responseMessage, Task`1 response)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet(String scope, String policyAssignmentName, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()'
DEBUG: CmdletException: ParserException - Expected literal (number, boolean, or null). Was '<'. :    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadIdentifer()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadLiteral()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadNext()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.TokenReader.Next()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonParser..ctor(SourceReader sourceReader)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(SourceReader sourceReader)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(String text)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.<>c.<PolicyAssignmentsGet_Call>b__44_1(Task`1 body)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.onDefault(HttpResponseMessage responseMessage, Task`1 response)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet(String scope, String policyAssignmentName, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()
   at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()
DEBUG: CmdletProcessRecordEnd: 
Get-AzPolicyAssignment_Get: C:\bgates\PowerShell\Modules\Az.Resources\7.4.0\Policy.Autorest\custom\Get-AzPolicyAssignment.ps1:250:19
Line |
 250 |      $scriptCmd = {& $wrappedCmd @calledParameters}
     |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Expected literal (number, boolean, or null). Was '<'.
DEBUG: Setting WindowTitle: My Terminal [main] - PowerShell 7.4 (42880)

Environment data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

get-module az*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     3.0.4                 Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     7.4.0                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}

Error output

Resolve-AzError
DEBUG: 14:46:00 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 14:46:00 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 14:46:00 - using account id '[email protected]'...
DEBUG: 14:46:00 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 14:46:00 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 32

Message        : Expected literal (number, boolean, or null). Was '<'.
StackTrace     :    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadIdentifer()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadLiteral()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadNext()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.TokenReader.Next()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonParser..ctor(SourceReader sourceReader)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(SourceReader sourceReader)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(String text)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.<>c.<PolicyAssignmentsGet_Call>b__44_1(Task`1 body)
                    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
                    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
                 --- End of stack trace from previous location ---
                    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
                    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
                 --- End of stack trace from previous location ---
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.onDefault(HttpResponseMessage responseMessage, Task`1 response)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet(String scope, String policyAssignmentName, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()
Exception      : Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.ParserException
InvocationInfo : {Get-AzPolicyAssignment_Get}
Line           :     $scriptCmd = {& $wrappedCmd @calledParameters}

Position       : At C:\bgates\PowerShell\Modules\Az.Resources\7.4.0\Policy.Autorest\custom\Get-AzPolicyAssignment.ps1:250 char:19
                 +     $scriptCmd = {& $wrappedCmd @calledParameters}
                 +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 32

DEBUG: 14:46:01 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 30

Message        : Cannot validate argument on parameter 'Uri'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
StackTrace     :    at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
                    at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
                    at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
                    at System.Management.Automation.CmdletParameterBinderController.BindNamedParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter)
                    at System.Management.Automation.ParameterBinderController.BindNamedParameters(UInt32 parameterSets, Collection`1 arguments)
                    at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)
                    at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
                    at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
                    at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
                    at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
                    at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
                    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
                 --- End of stack trace from previous location ---
                    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)     
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception      : System.Management.Automation.ParameterBindingValidationException
InvocationInfo : {Invoke-RestMethod}
Line           : $groups = Invoke-RestMethod -Method Get -Uri $groupUrl -Headers $authToken
Position       : At line:1 char:46
                 + $groups = Invoke-RestMethod -Method Get -Uri $groupUrl -Headers $auth+                                              ~~~~~~~~~
HistoryId      : 30

DEBUG: 14:46:01 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
Message        : The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
StackTrace     :    at System.Management.Automation.ValidateNotNullOrAttributeBase.Validate(Object arguments, EngineIntrinsics engineIntrinsics)
                    at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
Exception      : System.Management.Automation.ValidationMetadataException
InvocationInfo : {Invoke-RestMethod}
Line           : $groups = Invoke-RestMethod -Method Get -Uri $groupUrl -Headers $authToken
Position       : At line:1 char:46
                 + $groups = Invoke-RestMethod -Method Get -Uri $groupUrl -Headers $auth+                                              ~~~~~~~~~
HistoryId      : 30

DEBUG: 14:46:01 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 29

Message        : Expected literal (number, boolean, or null). Was '<'.
StackTrace     :    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadIdentifer()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadLiteral()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonTokenizer.ReadNext()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.TokenReader.Next()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonParser..ctor(SourceReader sourceReader)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(SourceReader sourceReader)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.JsonNode.Parse(String text)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.<>c.<PolicyAssignmentsGet_Call>b__44_1(Task`1 body)
                    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
                    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
                 --- End of stack trace from previous location ---
                    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
                    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
                 --- End of stack trace from previous location ---
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.onDefault(HttpResponseMessage responseMessage, Task`1 response)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Policy.PolicyAssignmentsGet(String scope, String policyAssignmentName, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()
                    at Microsoft.Azure.PowerShell.Cmdlets.Policy.Cmdlets.GetAzPolicyAssignment_Get.ProcessRecordAsync()
Exception      : Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.Json.ParserException
InvocationInfo : {Get-AzPolicyAssignment_Get}
Line           :     $scriptCmd = {& $wrappedCmd @calledParameters}

Position       : At C:\bgates\PowerShell\Modules\Az.Resources\7.4.0\Policy.Autorest\custom\Get-AzPolicyAssignment.ps1:250 char:19
                 +     $scriptCmd = {& $wrappedCmd @calledParameters}
                 +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 29



DEBUG: 14:46:01 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 14:46:01 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:3.0.4; CommandName: Resolve-AzError; PSVersion: 7.4.6; IsSuccess: True; Duration: 00:00:00.1822805; SanitizeDuration: 00:00:00.0148568
DEBUG: 14:46:01 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 14:46:01 - ResolveError end processing.
DEBUG: Setting WindowTitle: My Terminal [main] - PowerShell 7.4 (42880)
@powershellpr0mpt powershellpr0mpt added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Nov 29, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Nov 29, 2024
@VeryEarly VeryEarly added Policy Azure Resource Policy Service Attention This issue is responsible by Azure service team. labels Dec 5, 2024
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aperezcloud, @kenieva.

1 similar comment
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aperezcloud, @kenieva.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Policy Azure Resource Policy Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants