Aug 16 2018 12:31 PM
Hi,
I want to automate one task in Office 365 by using powershell and for this I registered an app in AAD (V2 endpoint https://apps.dev.microsoft.com) and given access to MS Graph API with permissions "Have full access to all site collections", "Read and Write all groups" (and so on) access to the app.
I am able to get the O365 group details via below PnP powershell commands but I am not sure how to get the context of SharePoint site or how to connect to a SP site within the same PS script by utilizing the same App credentials.
Connect-PnPOnline -AppId '<App Id>' -AppSecret '<App Secret>' -AADDomain 'tenant.onmicrosoft.com'
$group = Get-PnPUnifiedGroup -Identity 'hello team'
$spSiteUrl = $group.SiteUrl
Any tips how can I connect to SPO site?
Aug 17 2018 02:21 AM
to get the clientcontext you would do something like this:
Aug 19 2018 10:40 AM
Thanks but I am expecting to authenticate to SPO with the same App principal. In your example I have to pass the credentials which will not work in my case because I want to use the app id and secret.