【问题标题】:Azure Web App Powershell Resource Manager Mode - Connection String Slot SettingAzure Web App Powershell 资源管理器模式 - 连接字符串插槽设置
【发布时间】: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


    【解决方案1】:

    您可能已经知道可以在 Azure 服务管理模式中执行此操作,如下所示:

    > Switch-AzureMode -Name AzureServiceManagement
    > Set-AzureWebsite -Name myapp -SlotStickyConnectionStringNames @("my_db")
    

    不过,我很感激您的问题是关于使用 Azure 资源管理器的。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-22
    • 2019-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多