System.UnauthorizedAccessException in SharePoint Online Workflow Using REST Web Service Call

A SharePoint Online workflow was giving me trouble a couple of days ago. I was attempting to use the web service call within a list workflow to get specific User Profile properties and set them on list items (the post is here). The workflow kept failing and returning this response:

{“odata.error”:{“code”:”-2147024891, System.UnauthorizedAccessException”,”message”:{“lang”:”en-US”,”value”:”Access denied. You do not have permission to perform this action or access this resource.”}}}

After a mild amount of frustration, searching, and testing various methods, I found the solution. The solution is outlined in full detail at, but I originally found it through

The workflow finally completed after following all of the steps in the MSDN article above.