You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/manage/azure-automation-automated-export/README.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,16 +30,33 @@ Provides the scripts and lists the steps to set up automatically exporting your
30
30
31
31
## Script Set Up
32
32
33
+
Save the AutoExport.ps1 and AutoExportBlobRetention.ps1 files locally to make these edits
34
+
33
35
1. In the AutoExport.ps1 script, here are the values that need to be modified:
34
36
- $databaseServerPairs: This is where you put in the names of the databases you want to export along with the name of the server they are on.
37
+
Add them in the format: `[pscustomobject]@{serverName="SAMPLESERVER1";databaseName="SAMPLEDATABASE1"}` make sure to comma separate the items
35
38
- $serverCredentialsDictionary: If you are backing up from multiple servers, you can setup all of the credentials here and look them up by the server’s name later.
39
+
Add a $serverCred variable in the format `$serverCred1 = Get-AutomationPSCredential -Name 'NAMEOFSERVERCREDENTIAL1';` for each Azure Automation Credential you created. Increment the variable name (eg. $serverCred2 $serverCred3) for each one.
40
+
Add the $serverCreds to the dictionary in the format `'SAMPLESERVERNAME1'=$serverCred1;`
36
41
- $batchingLimit: This tells the script how many databases can be worked on at the same time (basically, the maximum number of database copies that there will be at once).
37
42
- $retryLimit: This tells the script how many times it can retry an operation.
38
43
- $waitTimeInMinutes: This tells the script how long it can wait for an operation to complete before it fails.
39
-
- $storageKeyVariableName: This is the AutomationAccount you created the StorageKey variable under (probably the same one you are running the RunBook under) and -Name is the name of the variable.
44
+
- $storageKeyVariableName: This is the Azure Automation string Variable name you created to store your Storage Key.
40
45
- $storageAccountName: This is the name of the storage account you are exporting to.
41
46
- $connectionAssetName: Connection Asset Name for Authenticating (Keep as AzureClassicRunAsConnection if you created the default RunAs accounts)
42
47
2. In AutoExportBlobRetention, here are the values that need to be modified:
43
-
- -Name for Get-AzureAutomationVariable: This is the AutomationAccount you created the StorageKey variable under (probably the same one you are running the RunBook under) and -Name is the name of the variable.
44
-
- $storageContainer: This is the name of the storage container where you will be monitoring the exported blobs.
48
+
- $storageKeyVariableName: This is the Azure Automation string Variable name you created to store your Storage Key.
49
+
- $storageAccountName: This is the name of your Storage Account you exported your bacpacs to.
50
+
- $storageContainerName: This is the name of the storage container where you will be monitoring the exported blobs.
45
51
- $retentionInDays: This is how many days you want to keep the exported blobs stored for before deleting.
52
+
53
+
## Adding the Script to Azure Automation
54
+
55
+
1. Import the scripts as Azure Automation Runbooks
56
+
- Create runbooks from the scripts you editted above by [following the instructions here](https://docs.microsoft.com/en-us/azure/automation/automation-creating-importing-runbook#to-import-a-runbook-from-a-file-with-the-azure-portal) for both scripts.
57
+
- [Make sure to publish the runbook.](https://docs.microsoft.com/en-us/azure/automation/automation-creating-importing-runbook#to-publish-a-runbook-using-the-azure-portal)
58
+
2. Add a schedule for your Automated Export runbook
59
+
- Create a recurring schedule by [following the instructions here](https://docs.microsoft.com/en-us/azure/automation/automation-schedules#to-create-a-new-schedule-in-the-azure-portal).
60
+
- Link the schedule(s) you created to the runbooks by [following the instructions here](https://docs.microsoft.com/en-us/azure/automation/automation-schedules#to-link-a-schedule-to-a-runbook-with-the-azure-portal).
61
+
62
+
You should now be all set up for Automated Exports into blob storage of your selected SQL Azure databases.
0 commit comments