-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Azure-Samples/windows
Add powershell scripts for Windows hooks
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Write-Host "Checking if authentication should be setup..." | ||
|
||
. ./scripts/load_env.ps1 | ||
|
||
if (-not $env:AZURE_USE_AUTHENTICATION) { | ||
Write-Host "AZURE_USE_AUTHENTICATION is not set, skipping authentication setup." | ||
Exit 0 | ||
} | ||
|
||
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue | ||
if (-not $pythonCmd) { | ||
# fallback to python3 if python not found | ||
$pythonCmd = Get-Command python3 -ErrorAction SilentlyContinue | ||
} | ||
|
||
Start-Process -FilePath ($pythonCmd).Source -ArgumentList "./scripts/auth_init.py" -Wait -NoNewWindow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
. ./scripts/load_env.ps1 | ||
|
||
Write-Host "Container app deployed at: $env:SERVICE_APP_URI" | ||
|
||
if (-not $env:AZURE_USE_AUTHENTICATION) { | ||
Exit 0 | ||
} | ||
|
||
|
||
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue | ||
if (-not $pythonCmd) { | ||
# fallback to python3 if python not found | ||
$pythonCmd = Get-Command python3 -ErrorAction SilentlyContinue | ||
} | ||
|
||
Start-Process -FilePath ($pythonCmd).Source -ArgumentList "./scripts/auth_update.py" -Wait -NoNewWindow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
foreach ($line in (& azd env get-values)) { | ||
if ($line -match "([^=]+)=(.*)") { | ||
$key = $matches[1] | ||
$value = $matches[2] -replace '^"|"$' | ||
[Environment]::SetEnvironmentVariable($key, $value) | ||
} | ||
} |