Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created September 18, 2017 06:56
Show Gist options
  • Save justinyoo/9dd9744fa0996d3a6271ebb19c624ade to your computer and use it in GitHub Desktop.
Save justinyoo/9dd9744fa0996d3a6271ebb19c624ade to your computer and use it in GitHub Desktop.
Azure Function Proxies for Mocking
#
# This adds/updates application settings blade to a given Azure Web App instance.
#
Param(
[string] [Parameter(Mandatory=$true)] $ResourceGroupName,
[string] [Parameter(Mandatory=$true)] $WebAppName,
[hashtable] [Parameter(Mandatory=$true)] $AppSettings,
[hashtable] [Parameter(Mandatory=$true)] $SqlConnectionStrings,
[hashtable] [Parameter(Mandatory=$false)] $CustomConnectionStrings = $null
)
$connectionStrings = @{}
foreach($key in $SqlConnectionStrings.Keys)
{
$connectionStrings.Add($key, @{ Type = "SQLAzure"; Value = $SqlConnectionStrings[$key] })
}
if ($CustomConnectionStrings -ne $null)
{
foreach($key in $CustomConnectionStrings.Keys)
{
$connectionStrings.Add($key, @{ Type = "Custom"; Value = $CustomConnectionStrings[$key] })
}
}
Set-AzureRmWebApp `
-ResourceGroupName $ResourceGroupName `
-Name $WebAppName `
-AppSettings $AppSettings `
-ConnectionStrings $connectionStrings
Remove-Variable connectionStrings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment