Skip to content

Commit 7fc6341

Browse files
fix(analyzer): suppress unavoidable ConvertTo-SecureString error in Azure CLI auth
PSScriptAnalyzer flagged PSAvoidUsingConvertToSecureStringWithPlainText as a blocking Error at Connect-RangerAzureContext (40-Execution.ps1:883), failing CI. The Azure CLI (az account get-access-token) returns the ARM access token as a plaintext string, and Connect-AzAccount -AccessToken requires a SecureString on Az.Accounts 5+, so an in-memory ConvertTo-SecureString is the only supported conversion — no secret is persisted. Added a scoped SuppressMessageAttribute with justification rather than altering behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent dc4c40a commit 7fc6341

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Modules/Private/40-Execution.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ function Connect-RangerAzureContext {
746746
avoiding MFA prompts on every run. Forwards Environment (sovereign
747747
cloud) and TenantId / Subscription to Connect-AzAccount.
748748
#>
749+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '',
750+
Justification = 'The Azure CLI (az account get-access-token) returns the ARM access token as a plaintext string; Connect-AzAccount -AccessToken requires a SecureString on Az.Accounts 5+, so an in-memory ConvertTo-SecureString is the only supported conversion. No secret is persisted.')]
749751
param(
750752
$AzureCredentialSettings
751753
)

0 commit comments

Comments
 (0)