如何将 PowerShell 命令的输出存储在 Azure DevOps 管道输出变量中并在下一阶段使用?

How to store output of PowerShell command in Azure DevOps Pipeline Output Variable and use it in next stage?

我正在尝试从 Azure DevOps Pipeline Azure PowerShell 任务执行以下代码并检索管道“输出变量”中的输出,并将输出变量用作下一阶段的输入。这该怎么做?下面的输出是数组还是对象?

PS C:\> Get-AzDataFactoryV2IntegrationRuntimeKey -ResourceGroupName 'rg-test-dfv2' -DataFactoryName 'test-df-eu2' -Name 'test-selfhost-ir'

AuthKey1                                                 AuthKey2
--------                                                 --------
IR@89895504-f647-48fd-8dd3-42fa556d67e3******            IR@89895504-f647-48fd-8dd3-42fa556d67e3****

output of this command is an object of PSIntegrationRuntimeKeys, to use the output variable as input to the next stage, you could follow this link - Passing variables from stage to stage in Azure DevOps Release Pipelines.

更新:

您可以使用下面的命令,将 $authkey1$authkey2 存储在单独的变量中。

$keys = Get-AzDataFactoryV2IntegrationRuntimeKey -ResourceGroupName <group-name> -DataFactoryName joyfactory -Name integrationRuntime2
$authkey1 = $keys.AuthKey1
$authkey2 = $keys.AuthKey2