gpt4 book ai didi

Azure 插槽 :Can i swap only app settings/connection strings?

转载 作者:行者123 更新时间:2023-12-03 00:22:52 28 4
gpt4 key购买 nike

有没有办法使用azure DevOps仅交换应用设置/连接字符串,而不交换Azure应用服务插槽中的代码管道还是Azure CLI

最佳答案

We are trying to get connectionstring directly from the slot and swap it to prod but not code.

据我所知,可以使用Azure CLI来实现。

应用程序设置:az webapp config appsettings

连接字符串:az webapp config connection-string

您可以使用 Azure CLI 列出应用程序设置/连接字符串。然后您可以使用 set 命令将值传递到插槽。

这是我的示例(在 Azure Devops Azure CLI 任务中):

$appsettings=az webapp config appsettings list --name webappname -g  ResourcesGroupName   --slot  slotname

$appsettings| Out-File "$(System.DefaultWorkingDirectory)\appsettings.json"

az webapp config appsettings set -g ResourcesGroupName -n webappname --settings -slot slotname "@$(System.DefaultWorkingDirectory)\appsettings.json"

$connectstring=az webapp config connection-string list --name webappname -g ResourcesGroupName --slot slotname

$test = $connectstring | ConvertFrom-Json


$test | Select-Object -Property Name,slotSetting ,type,Value | ForEach-Object {
Write-Host $_.Name $_.Value
$msg = $_.Name , $_.Value -join '='
echo $msg

az webapp config connection-string set --name webappname -g ResourcesGroupName -slot slotname -t mysql --settings $msg

}

注意:这是an known issue关于 az webapp config 连接字符串集。设置参数暂时不支持设置文件。

关于Azure 插槽 :Can i swap only app settings/connection strings?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65491614/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com