我正在尝试在我们的 Azure 环境中自动化工作流程。
我们有几个 Web 应用程序,带有到多个数据库的连接字符串。每个新客户都会收到一个新数据库。
我的连接字符串在脚本中遇到了障碍。我希望脚本更新所有 Web 应用程序并为新创建的客户数据库添加新的连接字符串。
问题是“Set-Azurermwebapp -Name -ResourceGroup -ConnectionStrings”
采用哈希表来替换任何先前配置的数据。
我只想附加一个新的连接字符串,或者获取之前配置的 cstrings 并将它们添加到数组中,然后替换所有数据。
示例代码;
$test= @{"Type"="Custom"; "Value" = "TestValue"}
$Connectionstring=@{"test"=$test }
Set-AzureRmWebApp
-Name "testapp"
-ResourceGroupName "testgrp"
-ConnectionStrings $Connectionstring"
这里有什么想法吗?
最佳答案
$connStrings = @{
AzureWebJobsDashboard = @{
Type = "Custom";
Value = $AzureWebJobsDashboard
};
AzureWebJobsStorage = @{
Type = "MySql";
Value = $connstring
}
};
Set-AzureRMWebApp -Name $webServiceName -ResourceGroupName $rgName -ConnectionStrings $connStrings
关于sql - 自动为 Web 应用程序创建新的连接字符串 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40156506/