Functions/Set-LocalDevEmail.ps1
Function Set-LocalDevEmail { [cmdletbinding()] param( [string] $email, [PSCustomObject] $config ) if ([string]::IsNullOrEmpty($email)) { if ($env:email) { Write-Host "Using environment variable for email." $email = $env:email } else { Write-Host "No local or environment-scoped email variable exists, fetching value from LDAP..." $email = ([adsi]"LDAP://$(whoami /fqdn)").mail } } $env:email = $email if ($email -notlike "*@*") { Write-Error "Missing email address. If you are not setting email address as a variable you will need to be connected to the VPN for the first time you run the pipeline script." Throw } [string]$databricksPath = $config.dataBricksPath $databricksPath = $databricksPath.Replace('__email__', $email) $config.DataBricksPath = $databricksPath if ($config.dbfsFiles){ $config.dbfsFiles = @($config.dbfsFiles | Foreach-object { $_.targetLocation = $_.targetLocation.Replace('__email__', $email);$_} ) } return $config } |