Publishing to Azure blob storage

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Publishing to Azure blob storage

Post by Dafra08 »

Is it possible to publish directly from Flare to Azure blob storage? If yes, how?

It would be nice to be able to set a destination directly to Azure, since you can use the options to only upload changed files and remove unused ones. Not to mention eliminating the risk of copying to the incorrect folder when doing it manually (while handling several outputs in several languages).

Have searched the forums and online, but nothing really spot on yet ...
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Re: Publishing to Azure blob storage

Post by Dafra08 »

Just for the record, solved with a PowerShell script that does the same thing. Not as convenient as publishing from within Flare, but as smooth as a workaround can possibly get.
burki
Jr. Propeller Head
Posts: 3
Joined: Sun Oct 25, 2020 11:28 pm

Re: Publishing to Azure blob storage

Post by burki »

Hello Dafra08,

I am interested in publishing to an Azure Blob storage as well.

Your solution sound interesting. Would it be possible to explain the details of your solution? How does the power shell script look like?

Thank you very much for any help!
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Re: Publishing to Azure blob storage

Post by Dafra08 »

Hi,

Absolutely! No problem. I had some developer help with the framework, but as soon as that's in place it is easy to modify which folders/files should be copied etc. When executing the script you will have to confirm the login to Azure. Then a DOS prompt with info on what's happening is displayed. The script checks if the files have been modified and only uploads/overwrites modified files. However, the log will say that all files have been overwritten, but it's so fast that it is just not possible.

We publish two help systems, one for public use, and one for internal use with certain extra info. The script for copying both help systems are included in one single PS1 file. Then we use two different shortcuts to call the different actions. If you only have one help system, it will be simpler. I have tried to include only the relevant parts for one target in the example below, so let's see if I get this right :)

Step 1
Install AzCopy, https://learn.microsoft.com/en-us/azure ... azcopy-v10. I am also quite sure I did something else to assure write permission to Azure, but can't really rememeber exactly what. It was a one time configuration.

Step 2
The script looks like this. I have kept a few variables in plain text, but other specific info that you need to fill in is replaced by numbers, ”xxxxx”, see explanations below.

Code: Select all

Connect-AzAccount

Set-AzContext -Subscription "11111"

$StorageAccount=Get-AzStorageAccount -ResourceGroupName "22222" -Name "33333"
$Context=$StorageAccount.Context  

$user = $env:UserName
$user = $user.Replace('.','_')

{
    echo "44444"
    $InternalContainerUrlWithToken = New-AzStorageContainerSASToken -Name "55555" -Permission rwdl -Context $Context -FullUri
    $internalDocsPath = ”C:\Git\MadCap\66666\Output\$user\internal\”
    .\azcopy sync $internalDocsPath $InternalContainerUrlWithToken --recursive=true --delete-destination=true --exclude-path="et;Lingo;Skins;internal.mclog;reports"
}

Write-Host -NoNewLine 'Press any key to continue...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
1. Azure subscription ID. Easily found under Account Management in Microsoft Azure Storage Explorer.
2. Select the storage account in Microsoft Azure Storage Explorer and get the resource group name from the properties.
3. Name of the storage account.
4. Info text about syncing files.
5. Name of the blob container.
6. Name of your Flare project. As you can see in the path, we use Git. We are two people using the script, hence we have a variable for the user name in the path, "$user". If you are the only one using the script I guess you can just grab the path to your project. "\internal" is the name of the target.

.\azcopy sync: Compares file names and last modified timestamps (and something else, since all files will have a newer time stamp after you build, but all files are not copied), https://learn.microsoft.com/en-us/azure ... zcopy-sync.
--recursive=true: Grabs all subfolders in the output folder.
--delete destination=true: Deletes files on Azure without asking, if you have removed them in your Flare project.
--exclude-path: Make some test runs and see what folders you don't need to copy in order to keep your Azure folder nice and tidy. Examples: I get a \Lingo folder that does not need to be copied to Azure, so I exclude that one. It also works the other way around. I have a custom solution for Estonian, which I copy to Azure manually. I exclude that folder ("et") so that it is not deleted when syncing the output folder.

Step 3
Build the Flare project as normal. Run the script and it should copy only changed files from the \Output folder to the Azure location you specified.

Let me know if it works, or if you need any other info.
Post Reply