I am using below pattern to create a container by passing variables using powershell, however there seems to be some issue with the context being created, which is not allowing me to create the container and is showing 404(the specified resource does not exist).
$storage= New-AzStorageAccount -ResourceGroupName $RESOURCE_GROUP_NAME -Location $LOCATION -Name $TF_STATE_STORAGE_ACCOUNT_NAME -SkuName Standard_LRS
$ctx=$storage.Context
New-AzStorageContainer -Name $TF_STATE_CONTAINER_NAME -Context $ctx
Note:(When i retried using the same command multiple times ,it showed me the same error and after around 10 minutes, my container got created, so maybe i am missing something regarding the context being created ??)
I have posted(link below as well) a question over the different context's being showed as referencing the LazyStorage Constructor of the namespace Microsoft.WindowsAzure.Commands.Common.Storage, however the cmdlet New-AzStorageContainer accepts type "Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext" as interface which should be fetching the AzureStorageContext Class not LazyAzureStorageContext Class.
https://docs.microsoft.com/en-us/powershell/module/az.storage/new-azstoragecontainer?view=azps-5.5.0
Question posted link :
Note: i have tried putting in Wait-Events as well between all the commands in the ps script, however of no use.
Note: i have tried using the commands with Azure CLI in powershell from azure portal's console and facing similar kind of issue with below error.