Skip to content

Commit ed1be7e

Browse files
fix: Conditionally use securestring for Connect-MgGraph (#409)
Co-authored-by: Stijn Moreels <9039753+stijnmoreels@users.noreply.github.com> Co-authored-by: Pim Simons <pim.simons@codit.eu>
1 parent f24f93a commit ed1be7e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/Arcus.Scripting.Tests.Integration/Connect-MgGraphFromConfig.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ $connection = Invoke-RestMethod `
1717

1818
$token = $connection.access_token
1919

20-
Connect-MgGraph -AccessToken $token
20+
$targetParameter = (Get-Command Connect-MgGraph).Parameters['AccessToken']
21+
22+
if ($targetParameter.ParameterType -eq [securestring]) {
23+
Connect-MgGraph -AccessToken ($token |ConvertTo-SecureString -AsPlainText -Force)
24+
}
25+
else {
26+
Connect-MgGraph -AccessToken $token
27+
}

0 commit comments

Comments
 (0)