azure - 使用 PowerShell 获取 Azure 自动化帐户连接的服务主体

标签 azure powershell azure-active-directory azure-automation

我知道如何在自动化帐户中运行 Runbook 时使用 Get-AutomationAccount 在内部检索连接详细信息。

但是,如果我希望能够报告 Runbook 作业外部的 AzureRunAsConnection 使用的服务主体,该怎么办?

我尝试过类似以下的操作:

$automationAccount = Get-AzAutomationAccount -ResourceGroupName $rg -Name $name
$conn = $automationAccount | Get-AzAutomationConnection
$conn.FieldDefinitionValues

但是,FielDefinitionValues 哈希表中没有任何内容?我期待看到诸如tenantId、ApplicationId 等内容。

我可以通过门户获取此信息,方法是单击:

AutomationAccount > Run as accounts > Azure RunAs Account

或通过

AutomationAccount > Connections > AzureRunAsConnection

但不知道如何从 PowerShell 获取 RunAs 帐户的此信息?

提前致谢。

最佳答案

是的,您需要使用$conn = $automationAccount | Get-AzAutomationConnection -名称“AzureRunAsConnection”

Maybe a bug?

这不是一个错误,因为这两个命令调用不同的 REST API。

使用$conn = $automationAccount | 时Get-AzAutomationConnection,它调用此其余 api Connection - List By Automation AccountfieldDefinitionValues 的详细信息不会公开,它始终为 null。您可以查看sample response或者用fiddler捕获powershell的请求。

enter image description here

使用$conn = $automationAccount | 时Get-AzAutomationConnection -Name "AzureRunAsConnection",它调用此其余 api Connection - GetfieldDefinitionValues 将包含您想要的属性。

enter image description here

关于azure - 使用 PowerShell 获取 Azure 自动化帐户连接的服务主体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59577925/

相关文章:

powershell - TFS2015 变量问题(Build.SourceBranch 和 Build.SourceBranchName)

powershell - 如何验证共享是否具有写权限?

Azure AD B2C 用户创建

azure - 如何使用应用服务对 Azure 函数应用进行身份验证/授权?

azure - 如何升级 Azure Databricks 中的 Hive 版本

Azure 逻辑应用程序和函数应用程序性能差异

powershell - 连接 2 个变量 (Powershell)

azure - 在 Azure AD Multi-Tenancy 环境中是否始终需要管理员同意?

javascript - 当promise解析时如何重新渲染React组件? |如何阻止渲染直到数据加载?

azure - AADSTS9002325 : Proof Key for Code Exchange is required for cross-origin authorization code redemption - Published on Azure