Invalid key exception

Symptoms

Error: “The Storage Account Key was invalid. Unable to connect to the host.”

Error: “An invalid key was encountered. This error is commonly associated with passwords or authorization keys. For more information see the "Raw Error Message". An attempt will be made to query for content at the next retry interval”

Causes

The key that is formed from the storage account connection string is invalid. The storage account key is in the connection string. If the key is altered, it might become invalid.

Resolving the problem

From the Azure portal, recopy the storage account connection string. It displays similar to the following example:

DefaultEndpointsProtocol=https;AccountName=<Storage Account Name>;AccountKey=<Storage Account Key>;EndpointSuffix=core.windows.net