From 2a75754ff908ed4997e39862d092a43dd084af71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=A5hlin?= Date: Fri, 25 Mar 2022 12:59:15 +0100 Subject: [PATCH] Use env vars for secret (#115) --- .pipelines/.templates/sharedSteps.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pipelines/.templates/sharedSteps.yml b/.pipelines/.templates/sharedSteps.yml index 353a620..5343b4b 100644 --- a/.pipelines/.templates/sharedSteps.yml +++ b/.pipelines/.templates/sharedSteps.yml @@ -72,6 +72,8 @@ steps: - task: PowerShell@2 displayName: "Connect" + env: + ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET) inputs: targetType: "inline" script: | @@ -84,7 +86,7 @@ steps: $azParams.Environment = '$(ARM_ENVIRONMENT)' } if('$(ARM_CLIENT_ID)') { - $azParams.credential = (New-Object PSCredential -ArgumentList '$(ARM_CLIENT_ID)', (ConvertTo-SecureString -String '$(ARM_CLIENT_SECRET)' -AsPlainText -Force)) + $azParams.credential = (New-Object PSCredential -ArgumentList '$(ARM_CLIENT_ID)', (ConvertTo-SecureString -String $Env:ARM_CLIENT_SECRET -AsPlainText -Force)) Connect-AzAccount -ServicePrincipal @azParams } else { Connect-AzAccount -Identity @azParams