问题描述
我正在尝试利用 Azure DevOps 中的变量组功能.
I am trying to leverage the Variable Group functionality in Azure DevOps.
我已在发布管道中创建了变量组并已关联.但是,当我将代码发布到 Azure 中的 Function App 时;当我转到功能应用程序中的配置设置时,自定义设置不存在.
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?
更新:解决这个问题;我需要写变量.这是我做的步骤.
UPDATE: To fix this; I needed to write the variables. This is the step I did it.
推荐答案
我通常在发布新代码后使用 powershell 任务来执行此操作.所以添加一个新的 powershell 任务并将其定义为内联:
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:将部署槽也定义为变量
PS: define the deployment slot as a variable too
这篇关于Azure DevOps 变量组未在 Azure 功能配置中应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!