Not able to import file from Azure Automation sandbox

Jeet Kamble 0 Reputation points
2023-12-20T19:05:14.3333333+00:00

Script: $resultTable | Export-Excel -Path $env:TEMP$excelFileName -AutoSize -AutoFilter -FreezeTopRow -BoldTopRow

Upload the Excel file to Storage Account

$storageContext = New-AzStorageContext -StorageAccountName $storageAccountName -UseConnectedAccount

echo $storageContext

Set-AzStorageBlobContent -Blob $excelFileName -Container $containerName -Context $storageContext -File "$env:TEMP$excelFileName"

Getting error at command Set-AzStorageBlobContent the file is not being retrive by it. Is there a specific perrmission reqired for managed identity

Failed
Could not open Excel Package C:\Users\ContainerAdministrator\AppData\Local\Temp\deleted_devices_20/12/2023_18:52.xlsx (Could not open Excel Package C:\Users\ContainerAdministrator\AppData\Local\Temp\deleted_devices_20/12/2023_18:52.xlsx)
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,370 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-12-29T21:14:06.8166667+00:00

    Thanks for posting your question in the Microsoft Q&A forum.
    I think in your Set-AzStorageBlobContent command, the path separators in the file name might be causing issues. Try to remove \ in the file name.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.