问题
How to enable diagnostics for a slot to Azure Table Storage?
I try:
> Enable-AzureWebsiteApplicationDiagnostic -Name mysite `
-LogLevel Verbose -Slot myslot -TableStorage `
-StorageAccountName 'mystorageaccountname'
fails:
ResourceNotFound: The storage account 'mystorageaccountname' was not found.
But it exists.
And when I do:
> Set-AzureRmCurrentStorageAccount –ResourceGroupName mygroup `
–StorageAccountName mystorageaccountname
> Enable-AzureWebsiteApplicationDiagnostic -Name mysite `
-LogLevel Verbose -Slot myslot -TableStorage
it fails:
Value cannot be null. Parameter name: accountName
whereas the doc says:
-StorageAccountName
Specifies the name of a storage account in which to store logs. The default value is the current storage account.
> gcm Enable-AzureWebsiteApplicationDiagnostic
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Enable-AzureWebsiteApplicationDiagnostic 5.3.0 azure
> get-module azure*
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 5.3.0 azure {Add-AzureAccount, Add-AzureApplicationGatewaySslCertif...
Script 4.3.2 Azure.Storage {Disable-AzureStorageDeleteRetentionPolicy, Enable-Azur...
Script 5.3.3 AzureRM.Profile {Add-AzureRmEnvironment, Clear-AzureRmContext, Clear-Az...
Script 5.0.0 AzureRM.Storage
Update. The same issue for the site.
> Enable-AzureWebsiteApplicationDiagnostic -Name mysite `
-LogLevel Verbose -BlobStorage -StorageBlobContainerName appslogs `
-StorageAccountName 'mystorageaccountname'
回答1:
I'm not sure the cause of this error. But I've found the similar thread in MSDN which you are experiencing now.
From that David Ebbo mentioned like
The old Enable-AzureWebsiteApplicationDiagnostic CmdLet may have issues. Please try something like this instead. Please look at what the config/log API returns in https://resources.azure.com/ to see everything that you can pass in there.
回答2:
I didn't find how to make Enable-AzureWebsiteApplicationDiagnostic work. And it seems that this Cmdlet can be removed. But Set-AzureRmResource was used to set the diagnostic for the site using Azure template. Please see full script at https://stackoverflow.com/a/51617949/511144
来源:https://stackoverflow.com/questions/51614311/enable-azurewebsiteapplicationdiagnostic-specify-storage-account-name