{"id":16538128,"url":"https://github.com/jamesmcroft/export-azure-sql-database-to-blob-storage","last_synced_at":"2025-03-03T21:15:14.647Z","repository":{"id":218188134,"uuid":"745819574","full_name":"jamesmcroft/Export-Azure-SQL-Database-To-Blob-Storage","owner":"jamesmcroft","description":"This runbook automates Azure SQL database backups to Blob Storage using Managed Identity.","archived":false,"fork":false,"pushed_at":"2024-01-20T16:14:12.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T05:11:46.459Z","etag":null,"topics":["azureautomationrunbookgallery","azuresql","azurestorage","module","powershell"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesmcroft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-20T08:33:04.000Z","updated_at":"2024-01-28T12:48:35.000Z","dependencies_parsed_at":"2024-01-20T10:23:18.280Z","dependency_job_id":"5adf423b-28c3-4b31-b6bc-4ae92db1574c","html_url":"https://github.com/jamesmcroft/Export-Azure-SQL-Database-To-Blob-Storage","commit_stats":null,"previous_names":["jamesmcroft/export-azure-sql-database-to-blob-storage"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmcroft%2FExport-Azure-SQL-Database-To-Blob-Storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmcroft%2FExport-Azure-SQL-Database-To-Blob-Storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmcroft%2FExport-Azure-SQL-Database-To-Blob-Storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmcroft%2FExport-Azure-SQL-Database-To-Blob-Storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesmcroft","download_url":"https://codeload.github.com/jamesmcroft/Export-Azure-SQL-Database-To-Blob-Storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241739542,"owners_count":20012105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azureautomationrunbookgallery","azuresql","azurestorage","module","powershell"],"created_at":"2024-10-11T18:44:28.891Z","updated_at":"2025-03-03T21:15:14.621Z","avatar_url":"https://github.com/jamesmcroft.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Export Azure SQL Databases To Blob Storage\n\nYou should use this runbook if you want to backup Azure SQL databases to Blob storage using a managed identity.\n\nA `.bacpac` file will be created for each database and stored in the specified Azure Storage blob container on every run of the runbook. The runbook will also delete any `.bacpac` files older than the specified retention period.\n\nThe files created will be named in the following format: `databaseName-yyyyMMddHHmm.bacpac`.\n\n## Prerequisites\n\n### Configuring Managed Identity\n\nYou will need to update the RBAC permissions of the system assigned managed identity in your Azure Automation account.\nAlternatively, create a user assigned managed identity and assign it to the Azure Automation account also.\n\nThe following permissions are required for the managed identity:\n\n- DevTest Labs User [Scope: Resource Group]\n- Reader [Scope: Resource Group]\n- Contributor [Scope: Azure SQL Server]\n- Storage Blob Data Contributor [Scope: Storage Account]\n\nIf you are using a user assigned managed identity, the system assigned managed identity will need the first two permissions.\n\nFor more information on how to configure managed identity with runbooks, see [this tutorial on Microsoft Docs](https://learn.microsoft.com/en-us/azure/automation/learn/powershell-runbook-managed-identity)\n\n\u003e Note: This runbook can be used together with Azure SQL database backups.\n\n### Configuring Azure Automation Runtime\n\nIf you are using the recommended PowerShell 7.2 runtime version, you will need to install the `Az.ManagedServiceIdentity` module from the PowerShell Gallery in your Azure Automation account, as this is not installed by default.\n\nTo do this, navigate to your Azure Automation account in the Azure portal, click on Modules under Shared Resources, and then click on Browse Gallery. Search for `Az.ManagedServiceIdentity` and install the latest version of the module.\n\n## Parameters\n\n- **ResourceGroupName**: The name of the resource group where the Azure resources are located.\n- **ManagedIdentityType**: The type of managed identity to use. Valid values are `System` and `User`.\n- **UserIdentityName**: The name of the user assigned managed identity to use. This parameter must be set if the ManagedIdentityType parameter is set to `User`.\n- **SqlServerName**: The name of the Azure SQL Server.\n- **SqlServerAdmin**: The username of the Azure SQL Server administrator.\n- **SqlServerAdminPw**: The password of the Azure SQL Server administrator.\n- **DatabaseNames**: A comma separated list of the names of the Azure SQL databases to backup.\n- **StorageAccountName**: The name of the Azure Storage account where the backups will be stored.\n- **StorageAccountKey**: The access key of the Azure Storage account where the backups will be stored. To locate this value, follow the instructions in [this Microsoft Docs article](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal#view-account-access-keys)\n- **BlobContainerName**: The name of the Azure Storage blob container where the backups will be stored. If the blob container does not exist, it will be created.\n- **RetentionDays**: The number of days to keep the backups in the Azure Storage blob container.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesmcroft%2Fexport-azure-sql-database-to-blob-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesmcroft%2Fexport-azure-sql-database-to-blob-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesmcroft%2Fexport-azure-sql-database-to-blob-storage/lists"}