@@ -120,6 +120,13 @@ if ($ServicePrincipalAuth) {
120120 $UserAuth = $false
121121}
122122
123+ if ($FederatedAuth ) {
124+ # Clear secrets if FederatedAuth is set. This prevents secrets from being
125+ # passed to pre- and post-scripts.
126+ $PSBoundParameters [' TestApplicationSecret' ] = $TestApplicationSecret = ' '
127+ $PSBoundParameters [' ProvisionerApplicationSecret' ] = $ProvisionerApplicationSecret = ' '
128+ }
129+
123130# By default stop for any error.
124131if (! $PSBoundParameters.ContainsKey (' ErrorAction' )) {
125132 $ErrorActionPreference = ' Stop'
@@ -282,8 +289,6 @@ function BuildDeploymentOutputs([string]$serviceName, [object]$azContext, [objec
282289 $serviceDirectoryPrefix = BuildServiceDirectoryPrefix $serviceName
283290 # Add default values
284291 $deploymentOutputs = [Ordered ]@ {
285- " ${serviceDirectoryPrefix} CLIENT_ID" = $TestApplicationId ;
286- " ${serviceDirectoryPrefix} TENANT_ID" = $azContext.Tenant.Id ;
287292 " ${serviceDirectoryPrefix} SUBSCRIPTION_ID" = $azContext.Subscription.Id ;
288293 " ${serviceDirectoryPrefix} RESOURCE_GROUP" = $resourceGroup.ResourceGroupName ;
289294 " ${serviceDirectoryPrefix} LOCATION" = $resourceGroup.Location ;
@@ -295,7 +300,9 @@ function BuildDeploymentOutputs([string]$serviceName, [object]$azContext, [objec
295300 }
296301
297302 if (! $FederatedAuth ) {
303+ $deploymentOutputs [" ${serviceDirectoryPrefix} CLIENT_ID" ] = $TestApplicationId ;
298304 $deploymentOutputs [" ${serviceDirectoryPrefix} CLIENT_SECRET" ] = $TestApplicationSecret ;
305+ $deploymentOutputs [" ${serviceDirectoryPrefix} TENANT_ID" ] = $azContext.Tenant.Id ;
299306 }
300307
301308 MergeHashes $environmentVariables $ (Get-Variable deploymentOutputs)
0 commit comments