首页 > 解决方案 > 从“Get-AzureRmEventHubKey”命令 power-shell 中提取 event-hub Microsoft-azure 的主键

问题描述

我想从“Get-AzureRmEventHubKey”的输出中获取主键并将其存储在一个变量中,我该如何通过 powershell 做到这一点?

标签: azureazure-powershellazure-eventhub

解决方案


您可以尝试以下 PowerShell cmdlet 从 even-hub 中提取主键:

$PrimaryKey = Get-AzureRmEventHubKey -ResourceGroupName myResourceGroup -NamespaceName namespace_name -Name RootManageSharedAccessKey |Select -ExpandProperty "PrimaryKey"

推荐阅读