Skip to main content

Azure Blob: Get Node

The Azure Blob: Get Node allows a workflow to download or retrieve a link to a blob in an Azure Blob Storage container.

Azure Blob: Get Node

Node Properties

There are four main configuration sections for the Azure Blob: Get Node ...

Credential Configuration

There are two options for configuring credentials:

Azure Blob: Get Node Credentials

Service Credential

Select an account key previously saved in Losant as an Azure service credential. Note: This option is not available in Edge Workflows.

Direct Input of Azure Credentials

There are two parts to directly configuring credentials, and both of them are templatable:

We recommend that you create an account key specifically for use in Losant workflows (keys that only have access to the proper Azure Blob container).

We also recommend that you store these values as workflow globals or service credentials.

Blob Configuration

Azure Blob: Get Node Config

Next is to configure the fields required by Azure Blob Storage. All applicable fields are templatable:

  • Container Name: (Required) The name of the container within the configured storage account.
  • Blob Name: (Required) The name of the blob to download, including the extension. If the file is in a subdirectory within the container, the path to the file should be included in this field. (e.g. "path/to/my/file.ext")
    • Note: In Azure, subdirectories with a leading slash (i.e. a subdirectory path beginning with "/") are treated as directories without names, and for retrieval purposes, they are separate paths from similar subdirectories that do not begin with a leading slash. Losant recommends not starting these paths with a leading slash.

Result Type

Next, choose what to return from the file request. Options are the following ...

  • Get Blob Contents: (Default) If selected, the blob contents will be placed on the payload under the result path defined below. Blobs retrieved by this method have a maximum size of 5MB.
  • Get Download Link: If selected, a pre-signed URL to download the blob will be placed on the payload under the result path defined below. This option is useful for larger blobs, as it does not have a size limitation. (Note: Download links retrieved this way will expire after 7 days.)
  • Local File Path Template: In edge workflows running GEA version 2.1.0 and higher, you can save the retrieved blob to the edge device's file system. If selected, specify a path to where the blob should be saved within the agent's Docker container. The field supports string templates.

When selecting the Get Blob Contents or Local File Path Template options, you must also specify a File Encoding. Default is UTF-8.

When selecting the Local File Path Template option, you must also choose how to handle conflicts if the file already exists at the specified path:

  • Cancel and return an error if the file exists: The operation will fail and return an error if a file already exists at the specified path.
  • Append my content to the file if it exists: The fetched content will be appended to the end of the file if it already exists.
  • Overwrite the file with my new content if it exists: (Default) The existing file will be overwritten with the newly fetched content.

Output

Finally, provide a Result Path as a payload path for where the result of the operation will be placed. This value is required.

When the operation successfully executes, the result will contain two keys: the value (whose contents depend on the selected result type as described in the examples), and some metadata about the file. When the operation encounters an error, the result will contain a single error key.

Node Example

The Azure Blob: Get Node's output varies with the selected result type:

When Get Blob Contents is selected, the result will look like the following:

{
"value":
"1, 2, 3, 4
12, 340, 360, 417
45, 318, 342, 391
56, 362, 406, 419",
"metadata": { "fileSize": 1890, "contentType": "text/plain", "etag": "\"0x8DA4A2A98327BB1\"" }
}

When Get Download Link is selected, the result will look like the following:

{
"value": "https://<Account>.blob.core.windows.net/<Container>/<Blob>",
"metadata": { "fileSize": 12720, "contentType": "application/json", "etag": "\"0x8DA4A2A98327BA1\"" }
}

When Local File Path Template is selected, the result will look like the following:

{
"value": "/path/to/saved/file.ext",
"metadata": { ... }
}

Node Errors

In the case of an error, the resulting object will contain an error key instead of the normal value and metadata keys.

{
"error": "Access Denied"
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.