Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Request_ResourceNotFound": "Resource '' does not exist or one of its queried reference-property objects are not present."

$
0
0

Hi,

I am trying to add approle assignments to existing user.This is the code I am using.The code looks fine[I have just modified the GraphApi console App].

  IPagedCollection<IApplication> applications = null; //Get the App where I want to add the functionality     applications = activeDirectoryClient.Applications.Where(e => e.AppId == "APPId").ExecuteAsync().Result; //Get the appApplication appObject = (Application)applications.FirstOrDefault(); AppRole appRole = new AppRole(); //Assign the first Approle to the approle    appRole = appObject.AppRoles.FirstOrDefault(); //retrived a single user  User user = (User)retrievedUsers.First(); //Assign the approleassignments to user AppRoleAssignment appRoles = new AppRoleAssignment();       

            appRoles.Id = appRole.Id;               

    appRoles.ResourceId = Guid.Parse(appObject.ObjectId);     

              appRoles.PrincipalDisplayName = appRole.DisplayName;       

            appRoles.ResourceDisplayName = appRole.DisplayName;           

        appRoles.PrincipalType = "User";               

    appRoles.PrincipalId = Guid.Parse(user.ObjectId); 

                  user.AppRoleAssignments.Add(appRoles);   

                user.UpdateAsync().Wait();


But when I ran It is giving me the error "Request_ResourceNotFound": "Resource 'Some random string' does not exist or one of its queried reference-property objects are not present."

also I am able to update other details,it works fine.I just search for the issue it seems like if some of the parameter is not found, then we will get this error.But here I am not creating anything am just assigning the values like appID,ObjectID,PrincipalID.Please help me resolve the issue.


Viewing all articles
Browse latest Browse all 16000

Trending Articles