Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
download-cloud

GitHub Action

Azure Blob Storage - Download Blob

v0.0.3 Pre-release

Azure Blob Storage - Download Blob

download-cloud

Azure Blob Storage - Download Blob

Download a blob from azure blob storage

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Azure Blob Storage - Download Blob

uses: armanrahman22/azblob-download-action@v0.0.3

Learn more about this action in armanrahman22/azblob-download-action

Choose a version

Azure Blob Download Action

This action downloads an azure blob to the specified destination

Sample workflows to download Azure Blob

with Azure Login Action

# File: .github/workflows/workflow.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # checkout the repo
      - uses: actions/checkout@master
      - uses: Azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}
      - name: Azure Blob Storage - Download Blob
        uses: armanrahman22/azblob-download-action
        with:
          storage-account-name: "my-account-name"
          container-name: "my-blob-name"
          blob-name: "my-blob-name"
          download-path: "."
      - name: View Output
        run: |
          ls
          cat my-blob-name

with connection string

# File: .github/workflows/workflow.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # checkout the repo
      - uses: actions/checkout@master
      - name: Azure Blob Storage - Download Blob
        uses: armanrahman22/azblob-download-action
        with:
          connection-string: "my-connection-string"
          container-name: "my-blob-name"
          blob-name: "my-blob-name"
          download-path: "."
      - name: View Output
        run: |
          ls
          cat my-blob-name

with AZURE_CREDENTIALS secret

# File: .github/workflows/workflow.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # checkout the repo
      - uses: actions/checkout@master
      - name: Azure Blob Storage - Download Blob
        uses: armanrahman22/azblob-download-action
        with:
          storage-account-name: "my-storage-account-name"
          creds: ${{ secrets.AZURE_CREDENTIALS }}
          container-name: "my-blob-name"
          blob-name: "my-blob-name"
          download-path: "."
      - name: View Output
        run: |
          ls
          cat my-blob-name

Configure Azure credentials

To fetch the credentials required to authenticate with Azure, run the following command to generate an Azure Service Principal (SPN) with Contributor permissions:

az ad sp create-for-rbac --name "myApp" --role contributor \
                            --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \
                            --sdk-auth

  # Replace {subscription-id}, {resource-group} with the subscription, resource group details of your keyvault

  # The command should output a JSON object similar to this:

  {
    "clientId": "<GUID>",
    "clientSecret": "<GUID>",
    "subscriptionId": "<GUID>",
    "tenantId": "<GUID>",
    (...)
  }

Add the json output as a secret (let's say with the name AZURE_CREDENTIALS) in the GitHub repository.