0
votes

I am trying to apply the pattern for the newly released Azure AD extension as per the code provided in the sample https://github.com/WindowsAzureAD/WindowsAzureAD-GraphAPI-Sample-OrgChart on my own Azure MVC application. I am trying to use the createExtension method to start with. However when I call my application it returns - Resource "ObjectId" does not exist or one of its queried reference-property objects are not present.

The generated url which is failing is - https://graph.windows.net/.onmicrosoft.com/applications/"ObjectId"/extensionProperties?api-version=1.21-preview where the error reports that the "ObjectId" does not exist or one of its queried reference-property objects are not present.

To get the ObjectId for my app I have used the powershell command get-msolserviceprincipal and used the ObjectId field value for the application. Has anyone been able to apply the pattern on their own Azure MVC app? What could I be doing wrong? Any suggestion would be highly valuable.

Shas

1

1 Answers

0
votes

ok, I got the answer by some experimentation. To get the objectid for my app I just needed to execute the following web request in fiddler -

Get - https://graph.windows.net/"mytenant"/applications?api-version=1.21-preview

Request Header- Authorization: Host: graph.windows.net

[Note - Authkey you can get by running the Org-Chart program released by MS (Github url in my initial problem statement), setting up the correct Tenant, Client and ClientSectret keys in StringConstants.cs for the app, setting the breakpoint in HomeController.cs at the line AuthenticationResult authenticationResult = aadAuthentication.GetAuthenticationResult and noting the auth key in authenticationResult.]

This will return the details for all configured apps for the tenant. Note the objectId value for your app of interest. This should be used as the AppObjectId in the program in StringConstants.cs. So this value would replace "ObjectId" in the following url, and now the extension will get created. https://graph.windows.net/.onmicrosoft.com/applications/"ObjectId"/extensionProperties?api-version=1.21-preview

Shas