1

I'm adding Connection Strings to my Azure Web App using the AzureResourceManager mode in Powershell.

Using the Azure Resource Explorer I've found the correct Powershell to add a connection string to my web app

$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

However, I can't find a way of marking the Connection String as a Slot Setting, so that it doesn't move when switching between my Staging and Production deployment slots.

In the Portal, it's a simple checkbox alongside the connection string.

Thanks very much for any help!

1 Answer 1

1

You might already know that you can do this in the Azure Service Management Mode like this:

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

I appreciate, though, that your question is about using the Azure Resource Manager.

Sign up to request clarification or add additional context in comments.

2 Comments

Hello. Thanks @shaun-luttin, I did not know that was possible, so that's great because it will at least get the job done for now! I would still like to know if it's possible in Resource Manager mode though.
I too would like to know how to do it with the Resource Manager mode. I have posted a few questions around the web and will update my answer when I know. blog.amitapple.com/post/2014/11/azure-websites-slots/… and feedback.azure.com/forums/169385-web-apps-formerly-websites/… I have also asked on Yammer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.