I am trying to write some code that will create 2 Azure AD applications. The first is a web/web api application and the second is Cilent application. When complete, the client application should have access to the Web API.
I used the console app up on GitHub as a starting point and got it working in my test tenant. In the Oauth "Create an application section of the code, I added the following code.
Application appObject = new Application { DisplayName = "Test-Demo App" + Helper.GetRandomString(8) }; appObject.IdentifierUris.Add("https://localhost/demo/" + Guid.NewGuid()); appObject.ReplyUrls.Add("https://localhost/demo"); RequiredResourceAccess resource = new RequiredResourceAccess(); resource.ResourceAppId = "05648d91-c798-4703-a369-b82ef1d9c055"; appObject.RequiredResourceAccess.Add(resource);
When I run this code and try to add the application, I get an exception that says "
"{\"odata.error\":{\"code\":\"Request_BadRequest\",\"message\":{\"lang\":\"en\",\"value\":\"Property requiredResourceAccess.resourceAccess value is required but is empty or missing.\"},\"values\":[{\"item\":\"PropertyName\",\"value\":\"
requiredResourceAccess.resourceAccess\"},{\"item\":\"PropertyErrorCode\",\"value\":\"PropertyRequired\"}]}}"
I would like to know how to add a required resource to an Azure AD Application.
Andy Schneider http://get-powershell.com