Azure Blob Storage

When it comes to working with data in Power BI, you need to be able to connect to a data source. One popular data source is Azure Blob Storage. In this article, we will take a look at how to connect to Azure Blob Storage from inside Power BI using the Power Query M language code.

What is Azure Blob Storage?

Azure Blob Storage

Azure Blob Storage is a cloud-based object storage service provided by Microsoft Azure. It is designed to store large amounts of unstructured data, such as text or binary data. It can be used to store data for backup and disaster recovery, as well as for serving static content for web applications.

What is Power Query M Language?

Power Query M language is a functional, case-sensitive language used to create custom functions, queries, and data transformations in Power BI. It is a powerful tool that allows you to extend the capabilities of Power BI by writing your own custom code.

Connecting to Azure Blob Storage from Inside Power BI

To connect to Azure Blob Storage from inside Power BI, you will need to follow these steps:

1. Open Power BI and click on the “Get Data” button.

2. Select “Azure” from the list of available data sources.

3. Select “Azure Blob Storage” from the list of available Azure services.

4. Enter your Azure Blob Storage account name and account key.

5. Click on the “Connect” button to connect to the Azure Blob Storage data source.

Once you have connected to Azure Blob Storage, you can start writing Power Query M language code to transform the data and create custom visualizations.

Writing Power Query M Language Code for Azure Blob Storage

To write Power Query M language code for Azure Blob Storage, you will need to use the “Blob.Contents” function. This function allows you to retrieve the contents of a blob in Azure Blob Storage.

Here is an example of Power Query M language code for connecting to Azure Blob Storage and retrieving the contents of a blob:


let

Source = AzureStorage.Blobs(“https://.blob.core.windows.net”, [RelativePath=”container-name/blob-name”, AccountKey=”“]),

#”Imported Blob Contents” =

Binary.Buffer(Source{[#”Folder Path”=”container-name”,Name=”blob-name”]}[Content]),

#”Converted to Table” = Csv.Document(#”Imported Blob Contents”)

in

#”Converted to Table”


In this code, you will need to replace the following:

– `` with your Azure Blob Storage account name

– `container-name` with the name of the container in Azure Blob Storage where your blob is located

– `blob-name` with the name of the blob you want to retrieve

– `` with your Azure Blob Storage account key

Once you have updated the code with your account information, you can click on the “Close & Apply” button to apply the changes and load the data into Power BI.

Conclusion

In this article, we have looked at how to connect to Azure Blob Storage from inside Power BI using the Power Query M language code. With this knowledge, you can now easily retrieve data from Azure Blob Storage and transform it into custom visualizations in Power BI.

Power BI Training Courses by G Com Solutions (0800 998 9248)

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)

    Similar Posts