首页 > 解决方案 > 是否有等效于“az rest”的 PowerShell?

问题描述

我最近发现了这个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\"}"

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

编辑:我想执行通过 Azure AD Cmdlet 不可用的调用(还)。就像直接使用新类型的 replyUrls,或者为 AAD B2C (Beta API) 上传自定义策略一样。

标签: azureazure-powershellazure-cli

解决方案


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

Invoke-AzRestMethod
      -Path <String>
      -Method <String>
      [-Payload <String>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

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


推荐阅读