Trying to use New-MgIdentityGovernanceAccessReviewDefinition and need to know the correct way to use AdditionalNotificationRecipients in -BodyParameter

James Hamilton 10 Reputation points
2023-11-09T10:36:25.4666667+00:00

I'm using New-MgIdentityGovernanceAccessReviewDefinition to create Access Reviews. All properties are defined in @param block and using -BodyParameter. I'm trying to use AdditionalNotificationRecipients but when I check the Access Review after executing all config for review stages and schedule etc is correct except for "At end of review, send notification to" which remains unset.

I've tried a few variations for defining AdditionalNotificationRecipients settings based on other properties which set correctly and the documentation but unable to get this to work. Never receive an error, just doesn't set.


################################################################################################
                       AdditionalNotificationRecipients = @(
				                    @{
                                        NotificationRecipientScope = @(
                                            @{
     					                query = "/users/97686923-373b-4418-81d4-1d34b24d4497"
					                    queryType = "MicrosoftGraph"
                                        }
                                        )
                                        NotificationTemplateType = "CompletedAdditionalRecipients" 
					                    
				                    }		                    

    ################################################################################################                             
                                 
                                  AdditionalNotificationRecipients = @{
                                        NotificationRecipientScope = "******@domain.com"
                                        NotificationTemplateType = "CompletedAdditionalRecipients" 
					                    
				                    }

################################################################################################
			                    AdditionalNotificationRecipients = @(
				                    @{
					                    NotificationRecipientScope = "******@domain.com"
					                    NotificationTemplateType = "CompletedAdditionalRecipients"
				                    }
			                    )
################################################################################################

Can you confirm the correct usage of this please?

BODYPARAMETER <IMicrosoftGraphAccessReviewScheduleDefinition>: accessReviewScheduleDefinition

  • [(Any) <Object>]: This indicates any property can be added to this object.
  • [Id <String>]: The unique identifier for an entity. Read-only.
  • [AdditionalNotificationRecipients <IMicrosoftGraphAccessReviewNotificationRecipientItem[]>]: Defines the list of additional users or group members to be notified of the access review progress.
  • [NotificationRecipientScope <IMicrosoftGraphAccessReviewNotificationRecipientScope>]: accessReviewNotificationRecipientScope
  • [(Any) <Object>]: This indicates any property can be added to this object.
  • [NotificationTemplateType <String>]: Indicates the type of access review email to be sent. Supported template type is CompletedAdditionalRecipients, which sends review completion notifications to the recipients.

Thanks

James

Microsoft Security | Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. flatexDEGIRO Koberstein, Bernd 5 Reputation points
    2025-03-10T11:33:29.6133333+00:00

    Finally I got it working. The difference / solution is by using the correct type of brackets to create the required hash table.

           AdditionalNotificationRecipients = @(
    
                @{
    
                    NotificationRecipientScope = @{
    
                        "@odata.type" = "#microsoft.graph.accessReviewNotificationRecipientQueryScope"
    
                        query = "/v1.0/users/$AdditionalNotificationRecipientID"
    
                        queryType = "MicrosoftGraph"
    
                    }
    
                    NotificationTemplateType = "CompletedAdditionalRecipients"
    
                }
    
    1 person found this answer helpful.

  2. flatexDEGIRO Koberstein, Bernd 5 Reputation points
    2025-03-10T11:12:39.4466667+00:00

    Finally I was able to set the AdditionalNotificationsRecipients in an access review definition. The difference/solution is caused by the type of brackets

            AdditionalNotificationRecipients = @(
    
                @{
    
                    NotificationRecipientScope = @{
    
                        "@odata.type" = "#microsoft.graph.accessReviewNotificationRecipientQueryScope"
    
                        query = "/v1.0/users/$AdditionalNotificationRecipientID"
    
                        queryType = "MicrosoftGraph"
    
                    }
    
                    NotificationTemplateType = "CompletedAdditionalRecipients"
    
                }
    
            ) 
    

    With round brackets you will create a hash table. It is required to define a hash tableUser's image

    if you define it like this:

            AdditionalNotificationRecipients = @{   
    
                    NotificationRecipientScope = @{
    
                        "@odata.type" = "#microsoft.graph.accessReviewNotificationRecipientQueryScope"
    
                        query = "/v1.0/users/$AdditionalNotificationRecipientID"
    
                        queryType = "MicrosoftGraph"
    
                    }
    
                    NotificationTemplateType = "CompletedAdditionalRecipients"               
    
            }
    

    you will get

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.