-
Notifications
You must be signed in to change notification settings - Fork 8
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 #6 from CMeeg/feature/fix-azd-provision-image-reset
- Loading branch information
Showing
5 changed files
with
40 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
|
||
$envAzdPath = Join-Path $scriptDir "../../.azure/${env:AZURE_ENV_NAME}/.env" | ||
|
||
if (!(Test-Path $envAzdPath -PathType Leaf)) { | ||
# azd env file does not exist so there is nothing to do | ||
|
||
return | ||
} | ||
|
||
# Remove any env vars that were most likely set by provisioning the infrastructure - the infrastructure has been removed so they are no longer relevant | ||
|
||
$keysToKeep = @("AZURE_ENV_NAME", "AZURE_LOCATION", "AZURE_SUBSCRIPTION_ID", "AZURE_TENANT_ID") | ||
|
||
$envVars = @{} | ||
|
||
Get-Content $envAzdPath | ForEach-Object { | ||
$key, $value = $_ -split '=', 2 | ||
|
||
if ($keysToKeep -contains $key) { | ||
$envVars[$key] = $value | ||
} | ||
} | ||
|
||
$envVars.Keys | Sort-Object | ForEach-Object { | ||
"$_=$($envVars[$_])" | ||
} | Out-File $envAzdPath |
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
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