问题描述
我在Azure上有一个免费的付费集成帐户设置。我已经使用该门户网站毫无问题地产生了一些合作伙伴和协议。我现在正在寻找使用一些Powershell脚本来帮助控制将来创建这些合作伙伴和协议的方法。
在尝试创建脚本来创建合作伙伴时,我遇到了业务标识瓶颈。
New-AzIntegrationAccountPartner -ResourceGroupName $ ResourceGroupName… | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ |无效的企业标识。
$ResourceGroupName = 'rg-test'
$IntegrationAccountName = 'inter-test'
$PartnerName = 'TestPartner'
$BusinessIdentities = @{
Qualifier = "AS2Identity"
Value = "TestIdentity"
}
New-AzIntegrationAccountPartner -ResourceGroupName $ResourceGroupName -Name $IntegrationAccountName -PartnerName $PartnerName -BusinessIdentities $BusinessIdentities
在涉及哈希表时,我是否还没有意识到?
Powershell Core 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。假设命令Microsoft.Azure.Commands.LogicApp.Utilities.CmdletHelper.ConvertToBusinessIdentityList(Object businessIdentityObject)
中的代码New-AzIntegrationAccountPartner
需要用户提供Array对象。否则,将引发错误。有关更多详细信息,请参阅here和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