Publish-AzureVMDscConfiguration: Can not find your azure storage credential

Nowadays, you can manage DSC from Azure. But you may getting the following error when you try to run Publish-AzureVMDscConfiguration

Publish-AzureVMDscConfiguration : Can not find your azure storage credential. Please specify an storage context using the -StorageContext parameter, or set the
current storage account using “Set-AzureSubscription”, or set the “AZURE_STORAGE_CONNECTION_STRING” environment variable.

Here is the fix, you just need to define a Azure Storage Context by using New-AzureStorageContext.

$context = New-AzureStorageContext -StorageAccountName sddscdemo -StorageAccountKey {key} 

You can find your access key by visit your Azure > Storage > select your storage name > the option ‘Manage Access Key’ will be available on the bottom of the web page.

Copy the Primary Access Key and paste it into the above script.

Try to run Publish-AzureVMDscConfiguration with -StorageContext parameter with a $context value.