msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

New-MgEntitlementManagementAccessPackageResourceRequest - Attributes permissions

Open William-Francillette opened this issue 4 years ago • 5 comments

Hi,

I am trying to update the parameter Attributes from an access package resource using New-MgEntitlementManagementAccessPackageResourceRequest with a request type equal to adminUpdate

I receive the following error:

Only a Global Administrator can add or update attributes of a Resource.
    + CategoryInfo          : InvalidOperation: ({ body = Micros...sourceRequest }:) [], CimException
    + FullyQualifiedErrorId : GlobalAdminResourceAttributesAddUpdateValidationError,Microsoft.Graph.PowerShell.Cmdlets.NewMgEntitlementManagementAccessPackageResourceRequest_CreateExpanded
    + PSComputerName        : localhost

My application already has the following permissions assigned

EntitlementManagement.Read.All
EntitlementManagement.ReadWrite.All

What permission do I require to manage the attribute programmatically? Find the payload below

Thanks, William

{
    "RequestType":  "AdminUpdate",
    "CatalogId":  "f34c2d92-9e9d-4703-ba9b-955b6ac8dcb3",
    "AccessPackageresource":  {
                                  "Id":  "fc94f29c-6ad6-4653-be4c-0dc266587811",
                                  "OriginSystem":  "AadGroup",
                                  "ResourceType":  "Microsoft 365 Teams Group",
                                  "Description":  "Welcome to the team that we\u0027ve assembled to create the Mark 8.",
                                  "Url":  "https://teams.microsoft.com/l/team/19:c39d1951a55b4076bb77d1d0961e180e%40thread.tacv2/conversations?tenantId=69a71ce1-5ce7-4315-851c-340a222303ac",
                                  "DisplayName":  "Mark 8 Project Team",
                                  "OriginId":  "05b45f3f-3976-4f9c-9f0f-8fc96f446918",
                                  "Attributes":  [
                                                     {
                                                         "attributeName":  "city",
                                                         "isEditable":  true,
                                                         "isPersistedOnAssignmentRemoval":  true,
                                                         "attributeSource":  {
                                                                                 "@odata.type":  "#microsoft.graph.accessPackageResourceAttributeQuestion",
                                                                                 "question":  {
                                                                                                  "@odata.type":  "#microsoft.graph.accessPackageTextInputQuestion",
                                                                                                  "id":  "59b0019a-24b9-4ed7-8c90-59943cce3a49",
                                                                                                  "text":  {
                                                                                                               "localizedTexts":  [
                                                                                                                                      {
                                                                                                                                          "text":  "Loutoon",
                                                                                                                                          "languageCode":  "fr-FR"
                                                                                                                                      }
                                                                                                                                  ],
                                                                                                               "defaultText":  "luton2"
                                                                                                           },
                                                                                                  "isRequired":  false,
                                                                                                  "sequence":  0
                                                                                              }
                                                                             },
                                                         "attributeDestination":  {
                                                                                      "@odata.type":  "#microsoft.graph.accessPackageUserDirectoryAttributeStore"
                                                                                  }
                                                     },
                                                     {
                                                         "attributeName":  "country",
                                                         "isEditable":  false,
                                                         "isPersistedOnAssignmentRemoval":  false,
                                                         "attributeSource":  {
                                                                                 "@odata.type":  "#microsoft.graph.accessPackageResourceAttributeQuestion",
                                                                                 "question":  {
                                                                                                  "allowsMultipleSelection":  false,
                                                                                                  "@odata.type":  "#microsoft.graph.accessPackageMultipleChoiceQuestion",
                                                                                                  "id":  "824fc054-3fae-4810-8e22-58dec01c4118",
                                                                                                  "text":  {
                                                                                                               "localizedTexts":  [
                                                                                                                                      {
                                                                                                                                          "text":  "France",
                                                                                                                                          "languageCode":  "fr-FR"
                                                                                                                                      }
                                                                                                                                  ],
                                                                                                               "defaultText":  "France"
                                                                                                           },
                                                                                                  "isRequired":  false,
                                                                                                  "choices":  [
                                                                                                                  {
                                                                                                                      "actualValue":  "answer",
                                                                                                                      "displayValue":  {
                                                                                                                                           "localizedTexts":  [
                                                                                                                                                                  {
                                                                                                                                                                      "text":  "Response",
                                                                                                                                                                      "languageCode":  "en-GB"
                                                                                                                                                                  },
                                                                                                                                                                  {
                                                                                                                                                                      "text":  "Risposta",
                                                                                                                                                                      "languageCode":  "it-IT"
                                                                                                                                                                  },
                                                                                                                                                                  {
                                                                                                                                                                      "text":  "Reponse",
                                                                                                                                                                      "languageCode":  "fr-FR"
                                                                                                                                                                  }
                                                                                                                                                              ],
                                                                                                                                           "defaultText":  "answer"
                                                                                                                                       }
                                                                                                                  }
                                                                                                              ],
                                                                                                  "sequence":  0
                                                                                              }
                                                                             },
                                                         "attributeDestination":  {
                                                                                      "@odata.type":  "#microsoft.graph.accessPackageUserDirectoryAttributeStore"
                                                                                  }
                                                     }
                                                 ]
                              }
}

William-Francillette avatar Oct 29 '22 14:10 William-Francillette

This is by design; EntitlementManagement.ReadWrite.All requires an admin consent. Your tenant's admin must consent to the required permissions before making the call. See https://learn.microsoft.com/en-us/graph/permissions-reference#entitlement-management-permissions.

Please ask your Tenant's admin to through the steps at https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/grant-admin-consent and https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/grant-consent-single to consent to the required permissions.

peombwa avatar Oct 31 '22 18:10 peombwa

Closing as by design. Admin consent is required for high privilege permissions.

peombwa avatar Oct 31 '22 18:10 peombwa

Hi @peombwa

I'm using service principal + certificate thumbprint and already consent to the permissions see screenshot below: image

I am able to create a catalog and add resources to it however not able to create or modify the attributes and receive the error message above Is it possible to manage those attributes using service principal?

Thanks William

William-Francillette avatar Oct 31 '22 18:10 William-Francillette

Hi @peombwa

I'm using service principal + certificate thumbprint and already consent to the permissions see screenshot below: image

I am able to create a catalog and add resources to it however not able to create or modify the attributes and receive the error message above Is it possible to manage those attributes using service principal?

Thanks William

@William-Francillette Did you find a solution for this?

Virgil-Bulens avatar Mar 20 '24 10:03 Virgil-Bulens

I'm having the same issue in my tenant. Admin consent has been granted. Application (service principal) has been given "EntitlementManagement.ReadWrite.All" permission. Still getting the "Only a Global Administrator can add or update attributes of a Resource." I tried PowerShell New-MgEntitlementManagementAccessPackageResourceRequest commend, and HTTP GraphAPI https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/resourceRequests. Same error.

artomh avatar Apr 29 '24 15:04 artomh