This document describes how to use the associated utility scripts for the Remote Action get-file-from-device to:
- Prepare configuration
- Download file from blob
- Run and test the RA locally (mac only)
Allows you to run and test the Remote Action locally using the token and required parameters.
This script allows downloading a file from Azure Storage Blob using a read-only SAS token.
Usage: ./downloadFromBlob.sh <blob_path_file> [output_path] [-f]<blob_path_file>: Required path returned by the Remote Action, e.g.,M12345/etc/hosts[output_path]: Optional local file or directory path. If not provided, the filename from the blob will be used.-f: Force overwrite if the target file already exists.
Example:
./downloadFromBlob.sh M12345/etc/hosts ./output/ -fCreate a .envrc file at the root of the project:
export sas_upload_token="<upload SAS token>"
export sas_download_token="<download SAS token>"
export storage_account="<storage account name>"
export container="<container name>"
export target_file="<absolute path of test file used by run.sh>"
direnvwill auto-load these variables if configured (direnv allow).
- Log location (macOS):
/private/var/tmp/NexthinkRA/get-file-from-device.log
Files will be uploaded to the specidied container in the following path:
/<hostname>/<absolute_path_to_file>
Example:
/private/etc/passwdon hostmacbook123→
/macbook123/private/etc/passwd
PowerShell version of the download script for Azure Storage Blob.
- Usage and parameters will be similar to the MacOS version.
Create a PowerShell config file:
$sas_upload_token = "<upload SAS token>"
$sas_download_token = "<download SAS token>"
$storage_account = "<storage account name>"
$container = "<container name>"- The RA script will automatically download
jqandazcopyon MacOS if missing, into:/Users/Shared/.Scripts/bin