none
Get URL Azure Blob Storage Into SQL Database Table RRS feed

  • Question

  • hi everyone

    I have a blob storage account that contains photos or images. now i need the url address for each file in blob storage to be included in the sql database table.

    whether using SSIS or with C # or power shell. thank you in advance for your attention.
    Tuesday, March 10, 2020 8:18 AM

All replies

  • The URL is fixed based upon your storage account (which has to be globally unique). However if you're calling this from C# then you're likely using the Azure NuGet package and so the full URL isn't going to be useful if you intend to download files from it. When using the Azure SDK you connect to the account using a key-value pair URL, then connect to the container and then request the blob by its name. 

    The formal URL for a blob is documented here. Specifically it is of the format `https://<account>.blob.core.windows.net/<container>/<blobname>`. So if your storage account is called 'companyA', the container is called 'testcontainer' and the blob is called 'photos.png' then the path would be 'https://companyA/blob.core.windows.net/testcontainer/photos.png'. Note that blob names are case sensitive. Note also that blob names may have a "folder like" structure but it is still a single file in the blob.

    If you are interested in working with Azure storage in Powershell then refer to this getting started document which assumes you've installed the cmdlets for Azure.

    For C# you can install the appropriate NuGet package. However if you're trying to do this in SSIS then note that SSIS script tasks cannot reference assemblies outside the GAC and therefore you cannot use the Azure packages directly. Your options are to create a custom component (which is how we solve this problem) that can be loaded into SSIS or stick with the raw commands via HttpClient. Note however that you'll be working with JSON and .NET that comes with SSIS doesn't ship a JSON serializer (other than DataContractSerializer) so it is painful to use in SSIS.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, March 10, 2020 1:53 PM
    Moderator
  • Hi Oki K,

    Thank you for posting here.

    Please check the Azure documentation provided by Microsoft, they have a detailed explanation.

    Quickstart: Azure Blob storage client library v12 for .NET

    API reference documentation

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 11, 2020 5:45 AM