Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
trevorgermain
Advocate I
Advocate I

Attempt to create Azure AD Application programmatically failing

Attempting Applying permissions programmatically as per https://docs.microsoft.com/en-us/power-bi/developer/register-app. I have created the AD Application, and assigned the permissions required. I really want to automate consent.

 

I have successfully created the application, and the service principal. In posting to https://graph.microsoft.com/beta/OAuth2PermissionGrants with body:

{
    "principalId":  "<from AD user obtained via Get-AzureRMADUser>",
    "clientId":  "<service principal id from above created service principal>",
    "resourceId":  "c78b2585-1df6-41de-95f7-dc5aeb7dc98e",
    "consentType":  "Principal",
    "expiryTime":  "2019-12-12T22:04:37Z",
    "startTime":  "2017-12-12T22:04:37Z",
    "scope":  "Dataset.ReadWrite.All Dashboard.Read.All Report.Read.All Group.Read Group.Read.All Content.Create Metadata.View_Any Dataset.Read.All Data.Alter_Any"
}

 

I am getting the following error:

{
  "error": {
    "code": "Request_ResourceNotFound",
    "message": "Resource 'c78b2585-1df6-41de-95f7-dc5aeb7dc98e' does not exist or one of its queried reference-property objects are not present.",
    "innerError": {
      "request-id": "55f8836a-ec3c-4581-8122-82352b2411c1",
      "date": "2017-12-12T22:04:35"
    }
  }
}

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@trevorgermain wrote:

Attempting Applying permissions programmatically as per https://docs.microsoft.com/en-us/power-bi/developer/register-app. I have created the AD Application, and assigned the permissions required. I really want to automate consent.


@trevorgermain

Your question is actually more related to Azure AD. I've consulted some Azure AD dev guy, the answer is, it is not possible to automate consent. You can either consent in a pop up window or in Azure portal. For better response, I'd suggest your post in the dedicated AAD forum.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.