Customers User PATCH response returns 200 but not updating User Info

Jessie Yuan 201 Reputation points Microsoft Employee
2019-10-30T08:39:44.463+00:00

I am working on a script to update passwords for our customers users and ran into some weird behavior with the Partner Center API returning successfully but isn't actually updating anything. So I started trying other calls and it seems like I can Read everything but anything I try to Write to the partner center isn't working and I'm not receiving any errors and am getting a 200 response code.

I am a Global Admin in my organization, I have a registered Web App in the Partner Center and my App Registration in the Azure Portal has every permission granted for Partner Center API, Microsoft Graph, Windows Azure Active Directory and Microsoft Partner Center.

I can successfully get my access token and use it for any GET request I've tried. Below is the set up I am using in Postman to retrieve my access token(I've whited out the confidential values). The photo below that, is the response headers(minus the access token).

alt text

alt text

I can successfully use my bearer token for GET calls such as:
"https://api.partnercenter.microsoft.com/v1/customers/"
"https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}"
"https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/users"
"https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/users/{user-id}"

All of the above work great with no errors. But then I try to PATCH one of our customers users using:
"https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/users/{user-id}"

With a payload to just change the user's first name like this:
{
"firstName": "TestMatt",
"attributes": {
"objectType": "CustomerUser"
}
}

I get a 200 OK response back, with the user returned, but the firstName value hasn't been updated in the returned response or in the GUI. I created a test user with firstName "Test", to show the response I receive AFTER trying to PATCH with the above payload to change the firstName from "Test "to "TestMatt".

alt text

The behavior almost feels like Microsoft is accepting the PATCH but nothing is happening after and I don't get any error response or message to go off of.

I have been following these two guides to the letter:
https://learn.microsoft.com/en-us/partner-center/develop/update-user-accounts-for-a-customer
https://learn.microsoft.com/en-us/partner-center/develop/reset-user-password-for-a-customer

Also when I tried to do this a month ago with the same exact credentials to test it, it worked. I took a break from the project and came back to this behavior. I have also created a new App Registration in the Azure Portal, gave it all the permissions, and tried again from the start but experienced the same behavior.

Any ideas?

Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
352 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,571 Reputation points
    2019-10-31T01:34:19.407+00:00

    Hi,

    Would suggest to do a test with Partner Center SDK C# code like below:

      protected override void RunScenario()  
            {  
                // get customer user Id.  
                string selectedCustomerUserId = this.ObtainCustomerUserId("Enter the ID of the customer user to update details");  
      
                // get customer Id of the entered customer user.  
                string selectedCustomerId = this.ObtainCustomerId("Enter the ID of the corresponding customer to update customer user");  
                var partnerOperations = this.Context.UserPartnerOperations;  
      
                this.Context.ConsoleHelper.StartProgress("Getting customer user");  
      
                // get customer user.  
                var selectedCustomerUser = partnerOperations.Customers.ById(selectedCustomerId).Users.ById(selectedCustomerUserId).Get();  
                this.Context.ConsoleHelper.StopProgress();  
                this.Context.ConsoleHelper.WriteObject(selectedCustomerUser, "Selected customer User");  
      
                this.Context.ConsoleHelper.StartProgress("Getting customer");  
      
                // get customer.  
                var selectedCustomer = partnerOperations.Customers.ById(selectedCustomerId).Get();  
                this.Context.ConsoleHelper.StopProgress();  
                this.Context.ConsoleHelper.WriteObject(selectedCustomer, "Selected Customer");  
      
                var updatedCustomerUser = new CustomerUser()  
                {  
                    PasswordProfile = new PasswordProfile() { ForceChangePassword = true, Password = "Password!1" },  
                    DisplayName = "Shubham Bharti",  
                    FirstName = "Shubham",  
                    LastName = "Bharti",  
                    UsageLocation = "US",  
                    UserPrincipalName = Guid.NewGuid().ToString("N") + "@" + selectedCustomer.CompanyProfile.Domain  
                };  
      
                this.Context.ConsoleHelper.StartProgress("Updating the customer user");  
      
                // update customer user information  
                var updatedCustomerUserInfo = partnerOperations.Customers.ById(selectedCustomerId).Users.ById(selectedCustomerUserId).Patch(updatedCustomerUser);  
                this.Context.ConsoleHelper.StopProgress();  
                this.Context.ConsoleHelper.WriteObject(updatedCustomerUserInfo, "Updated customer user information");  
            }  
    

    And in the response and Dashboard UI, the customer user first name changed as expected:

    alt text

    alt text

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.