I have a azure powershell function app. The job of this function app is to generate azure storage account SAS token
I am using the following command to generate the token
$StartTime = Get-Date
$EndTime = $StartTime.AddMinutes(50.0)
$token = Get-AzStorageAccount -Name "<storage-account-name>" -ResourceGroupName "<resource-group-name>" | New-AzStorageContainerSASToken -Container <container-name> -Permission rdwl -StartTime $StartTime -ExpiryTime $EndTime
The code gave the valid sas token for some days. But since some time its throwing error
The Azure PowerShell context has not been properly initialized. Please import the module and try again
I saw a few questions mentioning "'session
has not been properly initialized'" and nowhere mention for context.
I need help in resolving this issue