Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: Get appRoleAssignments granted to a group

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
Get-MgGroupAppRoleAssignment -GroupId '2692d278-8323-4094-b286-e0ffce5e54a5' |
Format-List

{{ Add output here }}
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 7/29/2021 10:08:49 AM
DeletedDateTime :
Id : eNKSJiODlECyhuD_zl5UpexaKrcAYuZEhjCKxfNmzDM
PrincipalDisplayName : Marketing
PrincipalId : 2692d278-8323-4094-b286-e0ffce5e54a5
PrincipalType : Group
ResourceDisplayName : Common Data Service
ResourceId : 93af1c70-e87f-45df-8780-8af2d7afd05e
AdditionalProperties : {}
```

{{ Add description here }}

This example get all app role assignments granted to the specified group.
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: Get all application role assignments for a service principal

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId '0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61' | Format-List

{{ Add output here }}
```
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 8/31/2021 2:01:28 PM
DeletedDateTime :
Id : PRLbC6e4yUyMwr0XutBvYfZHkKGzlbxDr2I-QJWN9rs
PrincipalDisplayName : Example App
PrincipalId : 0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61
PrincipalType : ServicePrincipal
ResourceDisplayName : Office 365 Management APIs
ResourceId : 557aedfc-007c-4904-918a-7e6fed2e7403
AdditionalProperties : {[@odata.id, https://graph.microsoft.com/v2/fb625e04-52aa-42da-b10d-14f1195d665f/directoryObjects/$/Microsof
t.DirectoryServices.ServicePrincipal('0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61')/appRoleAssignments/PRLbC6e4yUyM
wr0XutBvYfZHkKGzlbxDr2I-QJWN9rs]}

{{ Add description here }}
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 8/31/2021 1:59:44 PM
DeletedDateTime :
Id : PRLbC6e4yUyMwr0XutBvYZsr7FiAW3pIqP4F9944yBc
PrincipalDisplayName : Example App
PrincipalId : 0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61
PrincipalType : ServicePrincipal
ResourceDisplayName : Office 365 SharePoint Online
ResourceId : 1c48f923-4fbb-4d37-b772-4d577eefec9e
AdditionalProperties : {[@odata.id, https://graph.microsoft.com/v2/fb625e04-52aa-42da-b10d-14f1195d665f/directoryObjects/$/Microsof
t.DirectoryServices.ServicePrincipal('0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61')/appRoleAssignments/PRLbC6e4yUyM
wr0XutBvYZsr7FiAW3pIqP4F9944yBc]}
```

This example gets the application role assignments that have been granted to the specified service principal.
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: List the owners of a service principal

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
Get-MgServicePrincipalOwner -ServicePrincipalId '1c48f923-4fbb-4d37-b772-4d577eefec9e'

{{ Add output here }}
Id DeletedDateTime
-- ---------------
8a7c50d3-fcbd-4727-a889-8ab232dfea01
```

{{ Add description here }}

This command lists the owners of the specified service principal.
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
### Example 1: {{ Add title here }}
### Example 1: Assign an app role to a group

```powershell
PS C:\> {{ Add code here }}
$appRoleAssignment = @{
"principalId"= "f07a8d78-f18c-4c02-b339-9ebace025122"
"resourceId"= "1c48f923-4fbb-4d37-b772-4d577eefec9e"
"appRoleId"= "00000000-0000-0000-0000-000000000000"
}

New-MgGroupAppRoleAssignment -GroupId 'f07a8d78-f18c-4c02-b339-9ebace025122' -BodyParameter $appRoleAssignment |
Format-List

{{ Add output here }}
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 8/19/2021 11:25:25 AM
DeletedDateTime :
Id : eI168IzxAkyzOZ66zgJRIqVVeeA1CVFKmaBn-MGn0Bw
PrincipalDisplayName : All Employees
PrincipalId : f07a8d78-f18c-4c02-b339-9ebace025122
PrincipalType : Group
ResourceDisplayName : Office 365 SharePoint Online
ResourceId : 1c48f923-4fbb-4d37-b772-4d577eefec9e
AdditionalProperties : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#groups('f07a8d78-f18c-4c02-b339-9ebace025122')/appRoleAssignments/$entity], [@odata.id, https://graph.microsoft.com/v2/fb625e04-52aa-42da-
b10d-14f1195d665f/directoryObjects/$/Microsoft.DirectoryServices.Group('f07a8d78-f18c-4c02-b339-9ebace025122')/appRoleAssignments/eI168IzxAkyzOZ66zgJRIqVVeeA1CVFKmaBn-MGn0Bw]}
```

{{ Add description here }}
In this example, the first command defines the `$appRoleAssignment` variable that defines the following:

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
-`principalId`: The id of the group to which you are assigning the app role.

{{ Add output here }}
```
-`resourceId`: The id of the resource servicePrincipal which has defined the app role.

-`appRoleId`: The id of the appRole (defined on the resource service principal) to assign to the group.

{{ Add description here }}
Learn more about the [AppRoleAssignment resource](/graph/api/resources/approleassignment?view=graph-rest-1.0).

The second command adds the role to the specified group.
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
### Example 1: {{ Add title here }}

```powershell
PS C:\> {{ Add code here }}
$appRoleAssignment = @{
"principalId"= "0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61"
"resourceId"= "557aedfc-007c-4904-918a-7e6fed2e7403"
"appRoleId"= "00000000-0000-0000-0000-000000000000"
}

New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId 0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61 -BodyParameter $appRoleAssignment | Format-List

{{ Add output here }}
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 8/31/2021 2:01:28 PM
DeletedDateTime :
Id : PRLbC6e4yUyMwr0XutBvYfZHkKGzlbxDr2I-QJWN9rs
PrincipalDisplayName : Example App
PrincipalId : 0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61
PrincipalType : ServicePrincipal
ResourceDisplayName : Office 365 Management APIs
ResourceId : 557aedfc-007c-4904-918a-7e6fed2e7403
AdditionalProperties : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#servicePrincipals('0bdb123d-b8a7-4cc9-8cc2-bd17
bad06f61')/appRoleAssignments/$entity], [@odata.id, https://graph.microsoft.com/v2/fb625e04-52aa-42da-b10d-1
4f1195d665f/directoryObjects/$/Microsoft.DirectoryServices.ServicePrincipal('0bdb123d-b8a7-4cc9-8cc2-bd17bad
06f61')/appRoleAssignments/PRLbC6e4yUyMwr0XutBvYfZHkKGzlbxDr2I-QJWN9rs]}
```

{{ Add description here }}
In this example, the first command defines the `$appRoleAssignment` variable that defines the following:

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
-`principalId`: The id of the client service principal to which you are assigning the app role.

{{ Add output here }}
```
-`resourceId`: The id of the resource `servicePrincipal` (the API) which has defined the app role (the application permission).

-`appRoleId`: The id of the appRole (defined on the resource service principal) to assign to the client service principal.

{{ Add description here }}
Learn more about the [AppRoleAssignment resource](/graph/api/resources/approleassignment?view=graph-rest-1.0).

The second command adds the role to the specified service principal.
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: Add an owner for a service principal

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
$newOwner = @{
"@odata.id"= "https://graph.microsoft.com/v1.0/directoryObjects/8a7c50d3-fcbd-4727-a889-8ab232dfea01"
}

{{ Add output here }}
New-MgServicePrincipalOwnerByRef -ServicePrincipalId '1c48f923-4fbb-4d37-b772-4d577eefec9e' -BodyParameter $newOwner
```

{{ Add description here }}

In this example, the first command defines the value for the `$newOwner` variable in a hashtable. The second command adds the new owner to the specified service principal.
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: Delete an application

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
Remove-MgApplication -ApplicationId '1bc44759-ef10-46de-b199-40c077768fff'
```

{{ Add description here }}

This example deletes the specified application.
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: Remove the application role assignment for a service principal

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
Remove-MgServicePrincipalAppRoleAssignment -AppRoleAssignmentId 'PRLbC6e4yUyMwr0XutBvYZsr7FiAW3pIqP4F9944yBc' -ServicePrincipalId '0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61'
```

{{ Add description here }}

This example removed the assignment of the specified service principal to the specified application role id.
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: Get appRoleAssignments granted to a group

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
Get-MgGroupAppRoleAssignment -GroupId '2692d278-8323-4094-b286-e0ffce5e54a5' |
Format-List

{{ Add output here }}
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 7/29/2021 10:08:49 AM
DeletedDateTime :
Id : eNKSJiODlECyhuD_zl5UpexaKrcAYuZEhjCKxfNmzDM
PrincipalDisplayName : Marketing
PrincipalId : 2692d278-8323-4094-b286-e0ffce5e54a5
PrincipalType : Group
ResourceDisplayName : Common Data Service
ResourceId : 93af1c70-e87f-45df-8780-8af2d7afd05e
AdditionalProperties : {}
```

{{ Add description here }}

This example get all app role assignments granted to the specified group.
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: Get all application role assignments for a service principal

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId '0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61' | Format-List

{{ Add output here }}
```
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 8/31/2021 2:01:28 PM
DeletedDateTime :
Id : PRLbC6e4yUyMwr0XutBvYfZHkKGzlbxDr2I-QJWN9rs
PrincipalDisplayName : Example App
PrincipalId : 0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61
PrincipalType : ServicePrincipal
ResourceDisplayName : Office 365 Management APIs
ResourceId : 557aedfc-007c-4904-918a-7e6fed2e7403
AdditionalProperties : {[@odata.id, https://graph.microsoft.com/v2/fb625e04-52aa-42da-b10d-14f1195d665f/directoryObjects/$/Microsof
t.DirectoryServices.ServicePrincipal('0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61')/appRoleAssignments/PRLbC6e4yUyM
wr0XutBvYfZHkKGzlbxDr2I-QJWN9rs]}

{{ Add description here }}
AppRoleId : 00000000-0000-0000-0000-000000000000
CreatedDateTime : 8/31/2021 1:59:44 PM
DeletedDateTime :
Id : PRLbC6e4yUyMwr0XutBvYZsr7FiAW3pIqP4F9944yBc
PrincipalDisplayName : Example App
PrincipalId : 0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61
PrincipalType : ServicePrincipal
ResourceDisplayName : Office 365 SharePoint Online
ResourceId : 1c48f923-4fbb-4d37-b772-4d577eefec9e
AdditionalProperties : {[@odata.id, https://graph.microsoft.com/v2/fb625e04-52aa-42da-b10d-14f1195d665f/directoryObjects/$/Microsof
t.DirectoryServices.ServicePrincipal('0bdb123d-b8a7-4cc9-8cc2-bd17bad06f61')/appRoleAssignments/PRLbC6e4yUyM
wr0XutBvYZsr7FiAW3pIqP4F9944yBc]}
```

This example gets the application role assignments that have been granted to the specified service principal.
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
### Example 1: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}

{{ Add output here }}
```
### Example 1: List the owners of a service principal

{{ Add description here }}

### Example 2: {{ Add title here }}
```powershell
PS C:\> {{ Add code here }}
Get-MgServicePrincipalOwner -ServicePrincipalId '1c48f923-4fbb-4d37-b772-4d577eefec9e'

{{ Add output here }}
Id DeletedDateTime
-- ---------------
8a7c50d3-fcbd-4727-a889-8ab232dfea01
```

{{ Add description here }}

This command lists the owners of the specified service principal.
Loading