是否有相当于“az rest”的PowerShell?

Ale*_*AIT 5 azure azure-powershell azure-cli

我最近发现了该az rest命令,它允许我执行经过身份验证的 REST 命令,而不必担心获取令牌。

https://www.codeisahighway.com/native-azure-rest-api-calls-now-available-in-azure-cli-2-0-67/

az rest --method patch --url "https://graph.microsoft.com/v1.0/users/johndoe@azuresdkteam.onmicrosoft.com" --body "{\"displayName\": \"jondoe2\"}"
Run Code Online (Sandbox Code Playgroud)

Azure Powershell 中是否有等效项?我需要进行一个无法通过任何AzAd...cmdlet 进行的调用。我会想象类似的东西Invoke-AzRestMethod,但这并不存在。

编辑:我想执行无法通过 Azure AD Cmdlet 执行的调用(目前)。例如直接使用新类型的replyUrls,或上传AAD B2C(测试版API)的自定义策略。

ala*_*ree 7

现在,您可以使用 Az Powershell 模块执行此操作

Invoke-AzRestMethod
      -Path <String>
      -Method <String>
      [-Payload <String>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Run Code Online (Sandbox Code Playgroud)

https://learn.microsoft.com/en-us/powershell/azure/manage-azure-resources-invoke-azrestmethod?view=azps-5.9.0

  • 在我提出最初的问题两周后发布......令人着迷 (4认同)