Azure / Azure/azure-powershell

【Az.Resources】Code signature verification fails depending on winsystemlocale

Open
#22,976 4 comments 0 reactions 1 assignee Claimed by @Nickcandy View on GitHub
Azure PS Team bug customer-reported good first issue needs-team-attention Tracking
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

When we import Az.Resources on Windows10, 11 with ja-JP or zh-CN locale, code sign verification fails for some of the scripts. It succeed with en-EU locale so scripts itself should not be forged.
Depending on the organization's compliance, the code signing verification policy may need to be "Allsigned".
So could you please take a look towards this issue ?

Repro Step:
1. Install Az.Resources module https://www.powershellgallery.com/packages/Az.Resources/6.11.1
2. Set WinSystemLocale to ja-JP
3. Set-ExecutionPolicy Allsigned
4. Import-Module Az.Resources

```
PS C:\Users\xxxxxx> Import-Module Az.Resources
. : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 cannot be
loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 might have
been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the
digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
```
Seems like OS level verification and Get-AuthenticodeSignature fails.
![image](https://github.com/Azure/azure-powershell/assets/107377167/fc638ea7-9440-47fa-af5e-d39522469b51)

**ja-JP locale (zh-CN locale has the same problem too)**
```
PS C:\Users\xxxx> Get-WinSystemLocale
LCID Name DisplayName
---- ---- -----------
1041 ja-JP Japanese (Japan)

PS C:\Users\xxxx> Get-AuthenticodeSignature "C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1"
Directory: C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal

SignerCertificate Status Path
----------------- ------ ----
72105B6D5F370B62FD5C82F1512F7AD7DEE5F2C0 HashMismatch ProxyCmdletDefinitions.ps1
```

**No problem with en-US locale**

```
PS C:\Users\xxxx> Get-WinSystemLocale
LCID Name DisplayName
---- ---- -----------
1033 en-US English (United States)

PS C:\Users\xxxxxxx> Get-AuthenticodeSignature "C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1"
Directory: C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal

SignerCertificate Status Path
----------------- ------ ----
72105B6D5F370B62FD5C82F1512F7AD7DEE5F2C0 Valid ProxyCmdletDefinitions.ps1
```

### Issue script & Debug output

```PowerShell
DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Desktop]. PSVersion is [5.1.20348.2031].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\Program
Files\WindowsPowerShell\Modules\Az.Accounts\2.13.1\StartupScripts\..\lib].
. : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 cannot be
loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 might have
been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the
digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\Az.MSGraph.internal.psm1:34 char:91
+ ... th -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
CmdletInvocationException: File C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 cannot be loaded. The contents of file C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 might have been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.b__0()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
ForEach-Object : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 cannot be
loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 might have
been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the
digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At line:3 char:146
+ ... l' -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [ForEach-Object], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ForEachObjectCommand
CmdletInvocationException: File C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 cannot be loaded. The contents of file C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 might have been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.b__0()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
ForEach-Object : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 cannot be
loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\internal\ProxyCmdletDefinitions.ps1 might have
been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the
digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At line:3 char:146
+ ... l' -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [ForEach-Object], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ForEachObjectCommand
. : File C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\New-AzADUser.ps1
cannot be loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\New-AzADUser.ps1 might have been changed
by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital
signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\Az.MSGraph.custom.psm1:15
char:90
+ ... ot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
. : File C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\Update-AzADUser.ps1
cannot be loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\Update-AzADUser.ps1 might have been
changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital
signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\Az.MSGraph.custom.psm1:15
char:90
+ ... ot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
CmdletInvocationException: File C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\New-AzADUser.ps1 cannot be loaded. The contents of file C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\New-AzADUser.ps1 might have been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.b__0()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
ForEach-Object : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\New-AzADUser.ps1 cannot be loaded. The
contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\custom\New-AzADUser.ps1 might have been changed
by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital
signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At line:3 char:144
+ ... m' -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [ForEach-Object], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ForEachObjectCommand
. : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 cannot be
loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 might have
been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the
digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\Az.MSGraph.psm1:114 char:91
+ ... th -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
CmdletInvocationException: File C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 cannot be loaded. The contents of file C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 might have been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.b__0()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
ForEach-Object : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 cannot be
loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 might have
been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the
digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At line:3 char:147
+ ... s' -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [ForEach-Object], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ForEachObjectCommand
CmdletInvocationException: File C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 cannot be loaded. The contents of file C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 might have been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.b__0()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
at Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
ForEach-Object : File C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 cannot be
loaded. The contents of file C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.11.1\MSGraph.Autorest\exports\ProxyCmdletDefinitions.ps1 might have
been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the
digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing..
At line:3 char:147
+ ... s' -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [ForEach-Object], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ForEachObjectCommand
```

### Environment data

```PowerShell
PS C:\Users\xxxxxxx> $PSVersionTable

Name Value
---- -----
PSVersion 5.1.20348.2031
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2031
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.11.1 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzR...
```

### Error output

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.