1
votes

I am trying to leverage the Variable Group functionality in Azure DevOps.

I have created the variable group within the Release pipeline and I have associated. However, when I release the code to the Function App in Azure; when I go to the Configuration settings in the Function app, the custom settings are not there.

Is there a step I am missing here on getting these to show up?

enter image description here

enter image description here

enter image description here

enter image description here

UPDATE: To fix this; I needed to write the variables. This is the step I did it.

enter image description here

1
it's missing the part where you read them and update the function appThiago Custodio
@ThiagoCustodio thanks--makes sense. Where is a step that I should add that?Flea
You should be using an Azure keyvault for storing secured variables, not an Azure DevOps pipeline. Your application can retrieve secrets directly from the keyvault at runtime. You're adding several additional steps and making secret management opaque and difficult for no reason.Daniel Mann

1 Answers

1
votes

I usually do this using a powershell task after publishing the new code. So add a new powershell task and define it as inline:

$appname = "name of your function app"
$rg = "name of resource group"
$webApp = Get-AzureRmwebApp -ResourceGroupName $rg -Name $appname
$webAppSettings = $webApp.SiteConfig.AppSettings
$hash = @{}
foreach ($setting in $webAppSettings) {
    $hash[$setting.Name] = $setting.Value
}
$hash['New name'] = $("pipelineVariable")
Set-AzureRMWebAppSlot -ResourceGroupName $rg -Name $appname -AppSettings $hash -Slot production

PS: define the deployment slot as a variable too