Namespace: microsoft.graph.identityGovernance
Run a workflow object on-demand with a specific scope. You can run any workflow on-demand, including scheduled workflows. Workflows created from the "Real-time employee termination" template are run on-demand only. When you run a workflow on demand, the tasks are executed regardless of whether the user state matches the scope and trigger execution conditions.
This API is available in the following national cloud deployments.
| Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
| Permission type |
Least privileged permission |
Higher privileged permissions |
| Delegated (work or school account) |
Not supported. |
Not supported. |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
Not supported. |
Not supported. |
Important
In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Lifecycle Workflows Administrator is the least privileged role supported for this operation.
HTTP request
POST /identityGovernance/lifecycleWorkflows/workflows/{workflowId}/activatewithscope
Request body
In the request body, supply a JSON representation of the parameters.
The following table shows the parameters that are required with this action.
| Parameter |
Type |
Description |
| subjects |
microsoft.graph.user collection |
The subjects for whom the workflow is activated. |
Response
If successful, this action returns a 204 No Content response code.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/identityGovernance/lifecycleWorkflows/workflows/14879e66-9ea9-48d0-804d-8fea672d0341/activatewithscope
Content-Type: application/json
{
"subjects": [
{ "id": "8cdf25a8-c9d2-423e-a03d-3f39f03c3e97"},
{ "id": "ea09ac2e-77e3-4134-85f2-25ccf3c33387"}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.IdentityGovernance.LifecycleWorkflows.Workflows.Item.MicrosoftGraphIdentityGovernanceActivateWithScope;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new ActivateWithScopePostRequestBody
{
AdditionalData = new Dictionary<string, object>
{
{
"subjects" , new List<object>
{
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("8cdf25a8-c9d2-423e-a03d-3f39f03c3e97")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("ea09ac2e-77e3-4134-85f2-25ccf3c33387")
},
}),
}
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.IdentityGovernance.LifecycleWorkflows.Workflows["{workflow-id}"].MicrosoftGraphIdentityGovernanceActivateWithScope.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.identitygovernance.lifecycleworkflows.workflows.item.microsoftgraphidentitygovernanceactivatewithscope.ActivateWithScopePostRequestBody activateWithScopePostRequestBody = new com.microsoft.graph.identitygovernance.lifecycleworkflows.workflows.item.microsoftgraphidentitygovernanceactivatewithscope.ActivateWithScopePostRequestBody();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
LinkedList<Object> subjects = new LinkedList<Object>();
property = new ();
property.setId("8cdf25a8-c9d2-423e-a03d-3f39f03c3e97");
subjects.add(property);
property1 = new ();
property1.setId("ea09ac2e-77e3-4134-85f2-25ccf3c33387");
subjects.add(property1);
additionalData.put("subjects", subjects);
activateWithScopePostRequestBody.setAdditionalData(additionalData);
graphClient.identityGovernance().lifecycleWorkflows().workflows().byWorkflowId("{workflow-id}").microsoftGraphIdentityGovernanceActivateWithScope().post(activateWithScopePostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const activatewithscope = {
subjects: [
{ id: '8cdf25a8-c9d2-423e-a03d-3f39f03c3e97'},
{ id: 'ea09ac2e-77e3-4134-85f2-25ccf3c33387'}
]
};
await client.api('/identityGovernance/lifecycleWorkflows/workflows/14879e66-9ea9-48d0-804d-8fea672d0341/activatewithscope')
.post(activatewithscope);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\MicrosoftGraphIdentityGovernanceActivateWithScope\ActivateWithScopePostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ActivateWithScopePostRequestBody();
$additionalData = [
'subjects' => [
[
'id' => '8cdf25a8-c9d2-423e-a03d-3f39f03c3e97',
],
[
'id' => 'ea09ac2e-77e3-4134-85f2-25ccf3c33387',
],
],
];
$requestBody->setAdditionalData($additionalData);
$graphServiceClient->identityGovernance()->lifecycleWorkflows()->workflows()->byWorkflowId('workflow-id')->microsoftGraphIdentityGovernanceActivateWithScope()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.identitygovernance.lifecycleworkflows.workflows.item.microsoft_graph_identity_governance_activate_with_scope.activate_with_scope_post_request_body import ActivateWithScopePostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ActivateWithScopePostRequestBody(
additional_data = {
"subjects" : [
{
"id" : "8cdf25a8-c9d2-423e-a03d-3f39f03c3e97",
},
{
"id" : "ea09ac2e-77e3-4134-85f2-25ccf3c33387",
},
],
}
)
await graph_client.identity_governance.lifecycle_workflows.workflows.by_workflow_id('workflow-id').microsoft_graph_identity_governance_activate_with_scope.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
HTTP/1.1 204 No Content