Skip to content

Instantly share code, notes, and snippets.

@codemillmatt
Created March 9, 2022 22:20
Show Gist options
  • Save codemillmatt/1309e1d90e66bc1db67a2930c16b7811 to your computer and use it in GitHub Desktop.
Save codemillmatt/1309e1d90e66bc1db67a2930c16b7811 to your computer and use it in GitHub Desktop.
Using a different storage account

This explains how to use a different storage account (other than the one Azure Functions does) for consuming events in module 1 of Microsoft Azure Developer: Develop Event Based Solutions course.

  1. Create a new app settings key and for its value have the connection string value for the storage account that contains the images and grayscale containers.
    • For this example, we'll call that key EventImageStorage
  2. In the Grayscale.cs file, update the function's Blob declaration attribute to read:
    [Blob("{data.url}", FileAccess.Read, Connection = "EventImageStorage")] Stream inputBlobStream,
  3. Then further down in the body of the function, when you new up the BlobServiceClient, change that to:
    var outputBlobServiceClient = new BlobServiceClient(
        Environment.GetEnvironmentVariable("EventImageStorage")
    );

What you're doing is making sure the blob handling points at the correct Azure Storage account. I was using the account as specified by AzureWebJobsStorage. But we don't need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment