{"id":19099782,"url":"https://github.com/fbeltrao/sql-filestream-to-storage-migration","last_synced_at":"2025-04-27T16:32:23.886Z","repository":{"id":90726336,"uuid":"138858908","full_name":"fbeltrao/sql-filestream-to-storage-migration","owner":"fbeltrao","description":"Tool to migrate SQL FileStream content to an Azure Storage","archived":false,"fork":false,"pushed_at":"2018-06-28T10:07:00.000Z","size":110,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T01:32:22.009Z","etag":null,"topics":["azure","azure-storage","dotnet-core","sql","sqlazure"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/fbeltrao.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-27T09:20:17.000Z","updated_at":"2024-09-13T17:58:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ac8dcaa-9192-4be1-bedd-b255553324d4","html_url":"https://github.com/fbeltrao/sql-filestream-to-storage-migration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeltrao%2Fsql-filestream-to-storage-migration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeltrao%2Fsql-filestream-to-storage-migration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeltrao%2Fsql-filestream-to-storage-migration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeltrao%2Fsql-filestream-to-storage-migration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fbeltrao","download_url":"https://codeload.github.com/fbeltrao/sql-filestream-to-storage-migration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251171669,"owners_count":21547137,"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":["azure","azure-storage","dotnet-core","sql","sqlazure"],"created_at":"2024-11-09T03:52:17.190Z","updated_at":"2025-04-27T16:32:23.374Z","avatar_url":"https://github.com/fbeltrao.png","language":"C#","funding_links":[],"categories":["azure","sql"],"sub_categories":[],"readme":"# SQL Server FileStream to Azure Storage\nA simple .NET Core 2.1 tool to help you migrate your [SQL Server FileStream](https://docs.microsoft.com/en-us/sql/relational-databases/blob/filestream-sql-server?view=sql-server-2017) contents to an Azure SQL database and Azure Blob Storage.\n\n![](./images/sql-filestream-to-storage-migration.png \"SQL Server FileStream to Azure Storage\")\n\n## Getting started\n- Visual Studio 2017, .NET Core 2.1\n- Azure SQL Database\n- Azure Blob Storage account\n- Replace the necessary database and storage connection strings in [appsettings.json](src/FileStreamToAzureStorageMigrator/appsettings.json)\n\n```json\n{\n  \"source\": {\n    \"sqlServerDatabaseConnectionString\": \"\u003c-- replace with SQL Server connection string --\u003e\",\n    \"filesStreamInfoCsvFile\": \"filestream.csv\"\n  },\n  \"destination\": {\n    \"azureSqlDatabaseConnectionString\": \"\u003c-- replace with Azure SQL connection string --\u003e\",\n    \"azureBlobStorageConnectionString\": \"\u003c-- replace with Azure Blob Storage connection string --\u003e\"\n  }\n}\n```\n- Go to the command line, to the directory where you cloned the repo:\n```csharp\n\u003e dotnet restore\n\u003e dotnet build src/FileStreamToAzureStorageMigrator.sln\n\u003e dotnet run --project src/FileStreamToAzureStorageMigrator/FileStreamToAzureStorageMigrator.csproj\n```\n\n- It all starts [here](/src/FileStreamToAzureStorageMigrator/Program.cs) in 2 easy steps\n```csharp\nclass Program\n    {\n        public static IConfiguration Configuration { get; set; }\n       \n        static async Task Main(string[] args)\n        {\n            InitializeConfiguration();\n\n            string sourceSqlServerDatabaseConnectionString = Configuration[\"source:sqlServerDatabaseConnectionString\"];\n            string destinationAzureSqlDatabaseConnectionString = Configuration[\"destination:azureSqlDatabaseConnectionString\"];\n            string destinationAzureBlobStorageConnectionString = Configuration[\"destination:azureBlobStorageConnectionString\"];\n            string filesStreamInfoCsvFile = Configuration[\"source:filesStreamInfoCsvFile\"];\n\n            // Step 1: copy the file contents to Blob Storage\n            var sqlServerToAzureBlobStorage = new SqlServerToAzureBlobStorage(sourceSqlServerDatabaseConnectionString, destinationAzureBlobStorageConnectionString, filesStreamInfoCsvFile);\n            await sqlServerToAzureBlobStorage.CopyDataAsync();\n\n            // Step 2: copy the files metadata (table) to Azure SQL\n            var filesMetadataToAzureSql = new CsvFilesMetadataToAzureSql(destinationAzureSqlDatabaseConnectionString, filesStreamInfoCsvFile);\n            await filesMetadataToAzureSql.CopyDataAsync();\n        }\n\n\n        /// \u003csummary\u003e\n        /// Configuration initialization\n        /// \u003c/summary\u003e\n        private static void InitializeConfiguration()\n        {\n            var builder = new ConfigurationBuilder()\n                    .SetBasePath(Directory.GetCurrentDirectory())\n                    .AddJsonFile(\"appsettings.json\");\n\n            Configuration = builder.Build();\n        }\n\n\n    }\n```\n\n- You can also adjust:\n  - The [FileStreamFile.cs](/src/FileStreamToAzureStorageMigrator/FileStreamFile.cs) class with the desired file metadata, to be migrated to the Azure SQL database table \n  - The [SqlServerToAzureBlobStorage.cs](/src/FileStreamToAzureStorageMigrator/SqlServerToAzureBlobStorage.cs) SQL queries in this class with the queries you need to fetch from you SQL Server database\n  \n### Contributors\n[@damirkusar](https://github.com/damirkusar), [@DjolePetrovic](https://github.com/DjolePetrovic), [@jonathandbailey](https://github.com/jonathandbailey),  [@meinradweiss](https://github.com/meinradweiss), [@fbeltrao](https://github.com/fbeltrao) and [@CarlosSardo](https://github.com/carlossardo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbeltrao%2Fsql-filestream-to-storage-migration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffbeltrao%2Fsql-filestream-to-storage-migration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbeltrao%2Fsql-filestream-to-storage-migration/lists"}