运行此脚本时出现以下错误
$storage_name = "<storage name>"
$key = "<key>"
$config_path="C:\diagnostics.wadcfgx"
$service_name="<service name>"
$storageContext = (New-AzureStorageContext -StorageAccountName $storage_name -StorageAccountKey $key)
Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -DiagnosticsConfigurationPath $config_path -ServiceName $service_name -Slot Staging -Role WorkerRole1
其次是错误:
Set-AzureServiceDiagnosticsExtension : Cannot bind parameter 'StorageContext'. Cannot convert the "Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext" value of type
"Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext" to type "Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext".
答案 0 :(得分:1)
我删除了变量$ storageContext并将存储帐户名和键值直接传递给命令,如下所示。
Set-AzureServiceDiagnosticsExtension -ServiceName $cloudService_name -Role $cloudWorkerRole_Name -StorageAccountName $wr_storageaccount_name -StorageAccountKey $wr_storageaccount_key -DiagnosticsConfigurationPath $local_configuration_path -Slot Production
它奏效了。谢谢