Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update the properties of governanceRoleSetting.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissions
The following table shows the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Supported resource |
Delegated (work or school account) |
Delegated (personal Microsoft account) |
Application |
Microsoft Entra ID |
PrivilegedAccess.ReadWrite.AzureAD |
Not supported. |
Not supported. |
Azure resources |
PrivilegedAccess.ReadWrite.AzureResources |
Not supported. |
Not supported. |
group |
PrivilegedAccess.ReadWrite.AzureADGroup |
Not supported. |
Not supported. |
The requester must also have at least one active administrator role assignment (owner
or user access administrator
) on the resource.
HTTP request
PATCH /privilegedAccess/azureResources/roleSettings/{id}
Request body
In the request body, supply the values for governanceRuleSettings that need to be updated.
Property |
Type |
Description |
adminEligibleSettings |
governanceRuleSetting collection |
The rule settings that are evaluated when an administrator tries to add an eligible role assignment. |
adminMemberSettings |
governanceRuleSetting collection |
The rule settings that are evaluated when an administrator tries to add a direct member role assignment. |
userEligibleSettings |
governanceRuleSetting collection |
The rule settings that are evaluated when a user tries to add an eligible role assignment. |
userMemberSettings |
governanceRuleSetting collection |
The rule settings that are evaluated when a user tries to activate his role assignment. |
Response
If successful, this method returns a 204 NoContent
response code. It doesn't return anything in the response body.
Error codes
This API returns the standard HTTP error codes. In addition, it returns the following custom error codes.
Error code |
Error message |
Details |
400 BadRequest |
RoleSettingNotFound |
The governanceRoleSetting does not exist in system. |
400 BadRequest |
InvalidRoleSetting |
The governanceRuleSettings values provided in the request body are not valid. |
Example
This example updates the role setting for Custom Role 3 in the subscription Wingtip Toys - Prod.
Request
PATCH https://graph.microsoft.com/beta/privilegedAccess/azureResources/roleSettings/5fb5aef8-1081-4b8e-bb16-9d5d0385bab5
Content-type: application/json
{
"adminEligibleSettings":[
{
"ruleIdentifier":"ExpirationRule",
"setting":"{\"permanentAssignment\":false,\"maximumGrantPeriodInMinutes\":129600}"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new GovernanceRoleSetting
{
AdminEligibleSettings = new List<GovernanceRuleSetting>
{
new GovernanceRuleSetting
{
RuleIdentifier = "ExpirationRule",
Setting = "{\"permanentAssignment\":false,\"maximumGrantPeriodInMinutes\":129600}",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.PrivilegedAccess["{privilegedAccess-id}"].RoleSettings["{governanceRoleSetting-id}"].PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewGovernanceRoleSetting()
governanceRuleSetting := graphmodels.NewGovernanceRuleSetting()
ruleIdentifier := "ExpirationRule"
governanceRuleSetting.SetRuleIdentifier(&ruleIdentifier)
setting := "{\"permanentAssignment\":false,\"maximumGrantPeriodInMinutes\":129600}"
governanceRuleSetting.SetSetting(&setting)
adminEligibleSettings := []graphmodels.GovernanceRuleSettingable {
governanceRuleSetting,
}
requestBody.SetAdminEligibleSettings(adminEligibleSettings)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
roleSettings, err := graphClient.PrivilegedAccess().ByPrivilegedAccessId("privilegedAccess-id").RoleSettings().ByGovernanceRoleSettingId("governanceRoleSetting-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
GovernanceRoleSetting governanceRoleSetting = new GovernanceRoleSetting();
LinkedList<GovernanceRuleSetting> adminEligibleSettings = new LinkedList<GovernanceRuleSetting>();
GovernanceRuleSetting governanceRuleSetting = new GovernanceRuleSetting();
governanceRuleSetting.setRuleIdentifier("ExpirationRule");
governanceRuleSetting.setSetting("{\"permanentAssignment\":false,\"maximumGrantPeriodInMinutes\":129600}");
adminEligibleSettings.add(governanceRuleSetting);
governanceRoleSetting.setAdminEligibleSettings(adminEligibleSettings);
GovernanceRoleSetting result = graphClient.privilegedAccess().byPrivilegedAccessId("{privilegedAccess-id}").roleSettings().byGovernanceRoleSettingId("{governanceRoleSetting-id}").patch(governanceRoleSetting);
const options = {
authProvider,
};
const client = Client.init(options);
const governanceRoleSetting = {
adminEligibleSettings: [
{
ruleIdentifier: 'ExpirationRule',
setting: '{\"permanentAssignment\':false,\'maximumGrantPeriodInMinutes\':129600}"
}
]
};
await client.api('/privilegedAccess/azureResources/roleSettings/5fb5aef8-1081-4b8e-bb16-9d5d0385bab5')
.version('beta')
.update(governanceRoleSetting);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\GovernanceRoleSetting;
use Microsoft\Graph\Beta\Generated\Models\GovernanceRuleSetting;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new GovernanceRoleSetting();
$adminEligibleSettingsGovernanceRuleSetting1 = new GovernanceRuleSetting();
$adminEligibleSettingsGovernanceRuleSetting1->setRuleIdentifier('ExpirationRule');
$adminEligibleSettingsGovernanceRuleSetting1->setSetting('{\"permanentAssignment\":false,\"maximumGrantPeriodInMinutes\":129600}');
$adminEligibleSettingsArray []= $adminEligibleSettingsGovernanceRuleSetting1;
$requestBody->setAdminEligibleSettings($adminEligibleSettingsArray);
$result = $graphServiceClient->privilegedAccess()->byPrivilegedAccessId('privilegedAccess-id')->roleSettings()->byGovernanceRoleSettingId('governanceRoleSetting-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.Governance
$params = @{
adminEligibleSettings = @(
@{
ruleIdentifier = "ExpirationRule"
setting = '{"permanentAssignment":false,"maximumGrantPeriodInMinutes":129600}'
}
)
}
Update-MgBetaPrivilegedAccessRoleSetting -PrivilegedAccessId $privilegedAccessId -GovernanceRoleSettingId $governanceRoleSettingId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.governance_role_setting import GovernanceRoleSetting
from msgraph_beta.generated.models.governance_rule_setting import GovernanceRuleSetting
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = GovernanceRoleSetting(
admin_eligible_settings = [
GovernanceRuleSetting(
rule_identifier = "ExpirationRule",
setting = "{\"permanentAssignment\":false,\"maximumGrantPeriodInMinutes\":129600}",
),
],
)
result = await graph_client.privileged_access.by_privileged_access_id('privilegedAccess-id').role_settings.by_governance_role_setting_id('governanceRoleSetting-id').patch(request_body)
Response
HTTP/1.1 204 No Content