【发布时间】:2015-11-28 01:33:48
【问题描述】:
我正在使用 Powershell 中的 AzureResourceManager 模式将连接字符串添加到我的 Azure Web 应用程序。
使用 Azure Resource Explorer 我找到了正确的 Powershell 来将连接字符串添加到我的网络应用程序
$PropertiesObject = @{
#Property = value;
MembershipConnection = @{
Value = "Server=tcp:members.database.windows.net,1433;Database=Membership;User ID=User@members;Password=passwordgoeshere;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";
Type = "2";
}
}
New-AzureResource -PropertyObject $PropertiesObject -ResourceGroupName $resGroup -ResourceType Microsoft.Web/sites/config -ResourceName "$siteName/connectionstrings" -OutputObjectFormat New -ApiVersion "2015-08-01" -Force
但是,我找不到将连接字符串标记为插槽设置的方法,以便在我的暂存和生产部署插槽之间切换时它不会移动。
在门户中,它是连接字符串旁边的一个简单复选框。
非常感谢您的帮助!
【问题讨论】:
标签: powershell azure