Guest User

Untitled

a guest
Jan 4th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $ResourceGroupName = "rg"
  2. $ServerName = "sqlserver"
  3. $StorageKeytype = "StorageAccessKey"
  4. $StorageKey = "examplestoragekey"
  5. $sqldbs = ("userdb1,userdb2")
  6. $UserName = "sqladminaccount"
  7. $BacpacUri_Stem = "https://example.blob.core.windows.net/sqlbackup/"
  8. $Password = Get-AutomationPSCredential -Name 'MyCredential'
  9. foreach ($sqldb in $sqldbs){
  10. $BacpacUri = $BacpacUri_Stem + $database + (Get-Date -Format ddmmyy) + ".bacpac"
  11. $exportRequest = New-AzureRmSqlDatabaseExport -ResourceGroupName $ResourceGroupName -ServerName $ServerName `
  12. -DatabaseName $Database -StorageKeytype $StorageKeytype -StorageKey $StorageKey -StorageUri $BacpacUri `
  13. -AdministratorLogin $UserName -AdministratorLoginPassword $Password
  14. }
Add Comment
Please, Sign In to add comment