locked
Create a Page Type Blob RRS feed

  • Question

  • Hi,

    I am downloading a SQL .bak file from a ftp server and uploading it to a container. When the logic app uses the create blob connector it creates a block type blob which can't be used by SQL Server 2012 to restore the backup. Is there any way to configure the create blob to make a page blob?

    Kind Regards,

    Michael

    Monday, December 3, 2018 10:17 AM

Answers

  • Hi Michael,

    You can use azure functions together with Logic Apps to do this !! Expose functions swagger which will behave same as as connector .

    using Microsoft.WindowsAzure.StorageClient;
    StorageCredentialsAccountAndKey creds = new StorageCredentialsAccountAndKey(accountName, key);
    string baseUri = string.Format("http://{0}.blob.core.windows.net", accountName);
    CloudBlobClient blobStorage = new CloudBlobClient(baseUri, creds);
    CloudBlobContainer container = blobStorage.GetContainerReference(containerName);
    container.CreateIfNotExist();
    CloudPageBlob pageBlob = container.GetPageBlobReference(blobName);
    pageBlob.Create(blobSize);


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    • Marked as answer by Michael_S_1 Thursday, December 6, 2018 8:56 AM
    Tuesday, December 4, 2018 10:25 PM

All replies

  • Hi,

    1) If i understand your question correctly you want to restore the SQL backup (On-Prem) to SQL Azure, which as per my understanding is not possible in direct way.

    To achive this you will probably needed the SSDT to migrate On-Prem database to SQL Azure(Refer Link#1).

    2) To upload the blobs to container one can get reference of CloudBlockblob object (Refer Link#2)

    Link#1https://blogs.msdn.microsoft.com/ssdt/2012/04/19/migrating-a-database-to-sql-azure-using-ssdt/

    Link#2 https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet?tabs=windows

    HTH


    Hope this Helps!!!! Regards, Note: Please Mark As Answered if you satisfy with Reply.

    Monday, December 3, 2018 11:36 AM
  • Hi Thanks for the response. 

    More explanation..

    SQL 2012 (on prem) has backups stored on an ftp server. Need to store these in blob storage and then restore them to an SQL 2012 running on vm in azure (NOT SQL Azure).

    I was trying to achieve the copying to blob storage just using the standard Logic App connectors but when the blob is created it is a "block blob" not a "page blob" that is required to restore to SQL 2012 when restoring from a blob storage.

    My question is basically can a Logic App create a "page blob" not a "block blob"? 

    Kind Regards,

    Michael

    Monday, December 3, 2018 1:40 PM
  • Hi Michael,

    You can use azure functions together with Logic Apps to do this !! Expose functions swagger which will behave same as as connector .

    using Microsoft.WindowsAzure.StorageClient;
    StorageCredentialsAccountAndKey creds = new StorageCredentialsAccountAndKey(accountName, key);
    string baseUri = string.Format("http://{0}.blob.core.windows.net", accountName);
    CloudBlobClient blobStorage = new CloudBlobClient(baseUri, creds);
    CloudBlobContainer container = blobStorage.GetContainerReference(containerName);
    container.CreateIfNotExist();
    CloudPageBlob pageBlob = container.GetPageBlobReference(blobName);
    pageBlob.Create(blobSize);


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    • Marked as answer by Michael_S_1 Thursday, December 6, 2018 8:56 AM
    Tuesday, December 4, 2018 10:25 PM
  • Hi,

    I assumed I could use a function app to achieve this. I was just wanting to know if there was a setting or configuration i had missed to allow the logic app connector to create the page blob without creating a separate azure function. If I dont get any other replies in the next day then I will mark your answer as the answer as it will achieve the end result I require just not as simply as I had hoped it might be.

    Kind Regards,

    Michael

    Wednesday, December 5, 2018 8:09 AM