Forum Discussion

Luis Valencia's avatar
Luis Valencia
Copper Contributor
Apr 17, 2019

How to create modern sites with code via app-only or any other mechanism.

I am developing a solution which is multi tenant, basically in the application I can register tenants, with a username and password, I save the password in Azure Key vault securely and from my point of view its secure enough as I am not storing passwords anywhere else and only the app itself can read passwords to execute tenant operations, like creation of communication sites, modern sites, etc.

 

I analyzed a bit the code of the PnP-Powershell and the credentials are actually saved into the windows credential manager.

 

Almost a year ago I wanted to do this solution with App-Only, but then there is no API for creating modern sites with App-Only thats why I choosed to do it as explained above, there is a uservoice for this:

https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform/suggestions/34236700-ability-to-use-app-only-calls-to-create-modern-sit

 

Analyzing the AuthenticationManager, I see there are some methods that dont use username and password but instead use certificates and return a ClientContext.

 

Speficially this: GetHighTrustCertificateAppOnlyAuthenticatedContext

On: https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/AuthenticationManager.cs#L481

 

 

Will this method allow creation of modern sites or it has also the same restriction as App-Only?  Is there anyother way that I can access other tenant via CODE without actually having their username and password stored in my design

 

App-Only would be ideal but its still not implemented.

 

 

4 Replies

Resources