Is there a way to authenticate with Azure ACS and a certificate (App Only context) ?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Hi, I have an application which currently queries SharePoint Online using App Only access, based on Azure ACS (following this documentation).
It is the only way I found to restrict permissions to one given SharePoint site, because Azure AD applications' permissions only allow Sites.*.All permissions (for instance Sites.ReadWrite.All), which is too wide for me, and not allowed by my Organization (this gives access to all SharePoint sites for the tenant).
I currently authenticate against https://accounts.accesscontrol.windows.net/{{TENANT_ID}}/tokens/OAuth/2, with grant type "client_credientials" + ClientId and ClientSecret. This works like a charm, I can access the SharePoint site without giving SharePoint application permissions at Azure AD level !
So far, so good !
However, I have a technical requirement change from security department, and I now need to authenticated using a certificate instead of ClientId + ClientSecret.
I searched for some time but couldn't find a way to use both ACS access + certificate.
I tried the following :
PnP.Framework.AuthenticationManager().GetACSAppOnlyContext(): Works well with client id + client secret, but no overload for certificatesPnP.Framework.AuthenticationManager.CreateWithCertificate(): Does not work, needSites.ReadWrite.Allpermissions at AAD level- Using MSAL,
Microsoft.Identity.Client.ConfidentialClientApplicationBuilder.Create(ClientId).WithCertificate(certificate).(new Uri($"https://accounts.accesscontrol.windows.net/{Tenantid}")).Build(): Does not work, needsSites.ReadWrite.Allpermissions at AAD level
I have no more idea...
Is there some method that I missed, or a way to restrict permissions to one site using Azure AD ?
Thanks !
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing AuthenticationManager.GetACSAppOnlyContext() and CreateWithCertificate(), then compare them with the MSAL ConfidentialClientApplicationBuilder approach described in the issue. Determine whether certificate authentication can work with Azure ACS while retaining site-scoped access. Done means documenting a supported entry point or clearly recording the limitation and required permissions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- authentication, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100