azure powershell 集成帐户合作伙伴创建身份无效

azure powerhsell integration account partner creation identities invalid

我在 Azure 上设置了付费和免费的集成帐户。我已经使用门户网站毫无问题地生成了一些合作伙伴和协议。我现在希望使用一些 powershell 脚本来帮助控制未来这些合作伙伴和协议的创建。

在尝试构建脚本来创建合作伙伴时,我遇到了业务标识方面的瓶颈。

New-AzIntegrationAccountPartner -ResourceGroupName $ResourceGroupName … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Invalid business identity.

$ResourceGroupName = 'rg-test'
$IntegrationAccountName = 'inter-test'
$PartnerName = 'TestPartner'

$BusinessIdentities = @{
    Qualifier = "AS2Identity"
    Value = "TestIdentity"
}

New-AzIntegrationAccountPartner -ResourceGroupName $ResourceGroupName -Name $IntegrationAccountName -PartnerName $PartnerName -BusinessIdentities $BusinessIdentities

参考:https://docs.microsoft.com/en-us/powershell/module/az.logicapp/new-azintegrationaccountpartner?view=azps-4.6.1

关于哈希表,有什么我不知道的吗?

Powershell 核心 MacOS 10.15.6

主要次要补丁 PreReleaseLabel BuildLabel


7 0 3


更新:

添加 Resolve-AzError 响应。

HistoryId: 4

Message        : Invalid business identity.
StackTrace     :    at Microsoft.Azure.Commands.LogicApp.Utilities.CmdletHelper.ConvertToBusinessIdentityList(Object businessIdentityObject)
                    at Microsoft.Azure.Commands.LogicApp.Cmdlets.NewAzureIntegrationAccountPartnerCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.Management.Automation.PSArgumentException
InvocationInfo : {New-AzIntegrationAccountPartner}
Line           : New-AzIntegrationAccountPartner -ResourceGroupName $ResourceGroupName -Name $IntegrationAccountName -PartnerName $PartnerName -BusinessIdentities 
                 $BusinessIdentities
Position       : At /Users/john/Desktop/run.ps1:10 char:1
                 + New-AzIntegrationAccountPartner -ResourceGroupName $ResourceGroupName …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 4

根据我的研究,当我们运行命令New-AzIntegrationAccountPartner时,我们需要将BusinessIdentities定义为Array。因为命令New-AzIntegrationAccountPartner中的代码Microsoft.Azure.Commands.LogicApp.Utilities.CmdletHelper.ConvertToBusinessIdentityList(Object businessIdentityObject)需要用户提供Array对象。否则,它会抛出错误。详情请参考here and here.

例如

$ResourceGroupName = 'testaks'
$IntegrationAccountName = 'test06'
$PartnerName = 'TestPartner'

$BusinessIdentities = @("<the Qualifier's value such as AS2Identity>","<The Value's value>")

New-AzIntegrationAccountPartner -ResourceGroupName $ResourceGroupName -Name $IntegrationAccountName -PartnerName $PartnerName -BusinessIdentities $BusinessIdentities