Get-AzStorageAccount: Your Azure Credentials Have Not Been Set Up or Have Expired
Get-AzStorageAccount Your Azure credentials have not been set up or have expired
A quick blog post today regarding dealing with Azure credentials issues as I keep getting this error in my scripts from time to time.
Get-AzStorageAccount : Your Azure credentials have not been set up or have expired
If you get this error even though you have logged in either by direct input or by passing in the credentials object it could be because you have several active sessions. Use the Clear-AzContext Cmdlt to clear the context, with the scope set to either Process or CurrentUser. There is also an option to pass in DefaultProfile which is the same as the AzContext, if you want to clear the credentials for a specific profile.
For some scripts or sessions you might want to disable autosave by using Disable-AzContextAutosave if you are only using the result locally and temporarily. The Cmdlet has similar params as the previous Cmdlet.
Last modified on 2021-01-20