I need a powershell script that will perform some simple operations:
1- download all databases from a sql server in Azure to local storage in a bacpac format
2- upload all these databases from step 1 to my local sql server instance. It must remove the database from my local sql server if it previously existed.
3- export databases from my local sql server instance to Azure SQL server (first removing the one already existing with the same name).
I need to be able to run step 1 and 2 in one pass. Then I need to be able to run step 3 separately.
Need a config file that will be read by the powershell script that will contain credentials (i.e. Azure Login, Password, Azure Subscription Id, Server Login, Password, Local SQL Server credentials, etc.). As part of the config file, the folder for the local storage of the bacpac should be included. I do not want to be prompted for the credentials.
For step 3, The database names to be uploaded will need to be in the config file and their corresponding name in Azure will also need to be in the config file. (i.e. Name on local sql instance is NewDB001 and the name once uploaded to Azure needs to be DB001). Note that there needs to be a variable number of databases to upload.
Need all steps to contain error handling and all activities need to be logged to a log file, which should be the same as the folder for local storage.
If required for step 1, a temporary Azure blob storage can be used. If used, the credentials and info should be stored in the config file and all data should be removed once downloaded.
I currently have a budget of around $50 for this.
You must setup you own MS Azure Test environment from which you will test the scripts before delivery.