Thank you @Sania for the additional details above.
A basic understanding of Azure Automation runbook execution should help clarify this doubt. When runbooks are designed to authenticate and run against resources in Azure, they run in an Azure sandbox. Azure Automation assigns a worker to run each job during runbook execution in the sandbox. Please see this link for more details - Runbook execution environment These sandboxes are isolated environment with access to only some of the location/path/directories.
The following section should help answer the question - ... which path I have to use if the PBIX file is stored in Azure storage container and how the PowerShell script can be created?
The script snippet provided by Manu above would download the blob content in the same directory inside sandbox from where script is running. You can access this path inside the script using ".\" --> for example, if the blob that you are downloading is named testBlob, it will be available in location .\testBlob
. (".\" stands for current directory).
Therefore, the pbixFilePath
can be initialized as $pbixFilePath = ".\Test.pbix"
Another option is to use $env:temp
as mentioned in the question. It is one of the environments variable available on local machine (on your workstation) which generally resolves to C:\Users\<username>\AppData\Local\Temp
In Azure Automation sandbox environment, this variable resolves to C:\Users\Client\Temp
Therefore, you could download the blob content using the following line:
Get-AzStorageBlobContent -Blob $blob -Container $ContainerName -Context $Ctx -Destination $env:temp #Destination parameter sets the target folder. By default it is local directory (.\)
In this case, you would initialize pbixFilePath
as $pbixFilePath = $env:temp+"\Test.pbix"
Either case is fine as long as the Automation limits are not exceeded.
Hope this helps. Please let us know if you have any questions.
Please 'Accept as answer' if it helped so that it can help others in the community looking for help on similar topics.