問題タブ [powershell-jobs]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
azure-active-directory - MFA が有効な Azure アカウントの資格情報を PowerShell ScriptBlock に渡す方法は?
$global:token = [Microsoft.Open.Azure.AD.CommonLibrary.AzureSession]::AccessTokens
$ceo = "<ceo_username>"
Import-Csv "C:\Users\abhilash\Music\users.txt" | ForEach-オブジェクト {
$scriptblock = {
param($ユーザープリンシパル名)
Connect-Azuread -AadAccessToken $global:token.AccessToken.AccessToken -accountid <my_username>
新しいオブジェクト PSObject -property @{
Manager1 = $l = (Get-AzureADUserManager -ObjectId $userprincipalname).userprincipalname
Manager2 = $m = if ($l -ne $null -and $l -ne $CEO) { (Get-AzureADUserManager -ObjectId $l).userprincipalname } else { $null }
Manager3 = $n = if ($m -ne $null -and $m -ne $CEO) { (Get-AzureADUserManager -ObjectId $m).userprincipalname } else { $null }
Manager4 = $o = if ($n -ne $null -and $n -ne $CEO) { (Get-AzureADUserManager -ObjectId $n).userprincipalname } else { $null }
} | @{N='User';E={$userprincipalname}},Manager1,Manager2,manager3,manager4 を選択
}
Start-Job $ScriptBlock -ArgumentList $_
}
While (Get-Job -State "Running") { Start-Sleep 10 }
ジョブを取得| 受信ジョブ
「他のコマンドレットを呼び出す前に Connect-AzureAD コマンドレットを呼び出す必要があります」...... アクティブなセッションを行った後でもこのエラーが発生し、accesstoken で接続しようとすると、「パラメーター 'AadAccessToken' の引数を検証できません」というエラーが発生します.引数が null または空です。null または空でない引数を指定してから、コマンドを再試行してください。