Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ResourceGroupName = "rg"
- $ServerName = "sqlserver"
- $StorageKeytype = "StorageAccessKey"
- $StorageKey = "examplestoragekey"
- $sqldbs = ("userdb1,userdb2")
- $UserName = "sqladminaccount"
- $BacpacUri_Stem = "https://example.blob.core.windows.net/sqlbackup/"
- $Password = Get-AutomationPSCredential -Name 'MyCredential'
- foreach ($sqldb in $sqldbs){
- $BacpacUri = $BacpacUri_Stem + $database + (Get-Date -Format ddmmyy) + ".bacpac"
- $exportRequest = New-AzureRmSqlDatabaseExport -ResourceGroupName $ResourceGroupName -ServerName $ServerName `
- -DatabaseName $Database -StorageKeytype $StorageKeytype -StorageKey $StorageKey -StorageUri $BacpacUri `
- -AdministratorLogin $UserName -AdministratorLoginPassword $Password
- }
Add Comment
Please, Sign In to add comment