You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Azure REST API移除角色资格调度请求时遇重复ID错误的问题咨询

Azure REST API移除角色资格调度请求时遇重复ID错误的问题咨询

我最近在尝试用Azure REST API管理角色的PIM流,创建操作是正常的——比如我可以成功设置某个组具备订阅 Contributor 角色的资格。但在更新或删除这个资格设置的时候,总是会抛出错误。

根据我对文档的理解,所有操作都应该用创建端点,但实际调用的时候却出问题了。下面是我用来尝试移除资格的脚本:

$url = "$baseUrl/$scope/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/${guid}?api-version=2020-10-01"

$currentDateTime = Get-Date (Get-Date).ToUniversalTime() -UFormat '+%Y-%m-%dT%H:%M:%S.000Z'

$body = @{
    "properties" = @{
        "roleDefinitionId" = "$roleDefinitionId"
        "PrincipalId"      = "$principalId"
        "RequestType"      = "AdminRemove"
        "scheduleInfo"     = @{
            "StartDateTime" = "$currentDateTime"
            "Expiration"    = @{
                "Type"        = "AfterDuration"
                "EndDateTime" = "$currentDateTime"
                "Duration"    = "P1D"
            }
        }
    }
} | ConvertTo-Json -Depth 10

# Create the resource if it doesn't exist
$response = Invoke-RestMethod -Uri $url -Method Put -Headers $headers -Body $body

当我使用AdminRemove这个请求类型尝试移除设置时,会收到错误:

"A role assignment request with Id: already exist"

同样的错误也会出现在使用AdminUpdate或AdminExtend请求类型的时候。

想请教一下,我应该怎么正确地移除这个PIM流呢?

备注:内容来源于stack exchange,提问作者E. Staal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 12:00:31