问题描述
举个例子更清楚我想做什么
$AzLogin = @{
Subscription = [string] 'SubscriptionID';
Tenant = [string] 'tenantID';
Credential = [System.Management.Automation.PSCredential] $credsServicePrincipal;
ServicePrincipal = $true;
}
try{
Connect-Azaccount @$AzLogin -errorAction Stop
}catch{
Write-Host "Error: $($_.exception)" -foregroundcolor red
}
这可以正常工作。
我想要做的是传递存储在对象“CSObject”的属性“CommonArgs”中的乱码参数,如下所示:
$CSObject =@ {
[PScustomObject]@{CommonArgs=$AzLogin;}
}
try{
Connect-Azaccount @CSObject.commonArgs -errorAction Stop
}catch{
Write-Host "Error: $($_.exception)" -foregroundcolor red
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)