Update-AzADApplication:找不到接受参数 $True 的位置参数 - Azure Az Powershell 模块

Update-AzADApplication: A positional parameter cannot be found that accepts argument $True - Azure Az Powershell Module

我正在尝试更新我在 Azure 中的 AD 应用程序注册的 属性。 根据文档,我可以使用 Update-AzADApplication 或 Set-AzADApplication。

我都试过了。但是下面的所有组合 return 都出现相同的错误信息:

 A positional parameter cannot be found that accepts argument '$True'.

Update-AzADApplication 尝试

PS C:\Users\me> Update-AzADApplication -ApplicationId [my-app-guid] -Oauth2RequirePostResponse $True
Update-AzADApplication: A positional parameter cannot be found that accepts argument 'True'.

PS C:\Users\me> Update-AzADApplication -ApplicationId [my-app-guid] -Oauth2RequirePostResponse $true
Update-AzADApplication: A positional parameter cannot be found that accepts argument 'True'.

PS C:\Users\me> Update-AzADApplication -DisplayName widgets-app-AdApp -Oauth2RequirePostResponse $True
Update-AzADApplication: A positional parameter cannot be found that accepts argument 'True'.

PS C:\Users\me> Update-AzADApplication -DisplayName widgets-app-AdApp -Oauth2RequirePostResponse True 
Update-AzADApplication: A positional parameter cannot be found that accepts argument 'True'.

PS C:\Users\me> Update-AzADApplication -DisplayName widgets-app-AdAppp -Oauth2RequirePostResponse true
Update-AzADApplication: A positional parameter cannot be found that accepts argument 'true'.

PS C:\Users\me> Update-AzADApplication -DisplayName widgets-app-AdApp -Oauth2RequirePostResponse $true
Update-AzADApplication: A positional parameter cannot be found that accepts argument 'True'.

我也试过这个:

PS C:\Users\me> $mytest = $True; 
PS C:\Users\me> $mytest
True
PS C:\Users\me> Update-AzADApplication -ApplicationId [my-app-guid] -Oauth2RequirePostResponse $mytest
Update-AzADApplication: A positional parameter cannot be found that accepts argument 'True'.
PS C:\Users\me>       

-Oauth2RequirePostResponse 是一个开关参数,因此不需要布尔值。

因此,PowerShell 假定您尝试传递的 $true 值是下一个参数。

删除 $true 它应该可以工作。

Update-AzADApplication -ApplicationId [my-app-guid] -Oauth2RequirePostResponse