We have a number of Cloud Deployment projects for our Cloud Services. e.g.
\-Project.Cloud.UAT
\-ServiceConfiguration.Cloud.cscfg
\-ServiceDefinition.csdef
\-Project.Cloud.Production
\-ServiceConfiguration.Cloud.cscfg
\-ServiceDefinition.csdef
And so on. Each cscfg file has the database connection string for that specific environment.
During the deployment of a cloud project, we run a powershell script which kicks off the azure cmdlets to deploy & start that cloud service.
I'd like to add a step now, to also run FluentMigrator against that environments database. I've previously used FM, and pointed it at a transformed Web.Config to get a SQL Connection string, but can't seem to get it working.
Could someone point me in the right direction with a powershell script to Open the CSCFG file, manually parse out the ConnectionString into a ps $var, and then pass that directly to fluent migrator.
I'm assuming you are storing the connection strings in the ConfigurationSettings sections. Below is a sample of PowerShell that will pull in the file and for each role pull out the specific settings named in the switch statement. You may not need the switch statement if you have a single connection string you are pulling. There is also likely a nicer way to handle the setting itself, but this does give you an example of pulling specific settings manually from the cscfg file.