This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PnPPowerShellAppId = "31359c7f-bd7e-475c-86db-fdb8c937548e" | |
# Connect to you Azure AD, use Global admin or equivalent account | |
Connect-AzAccount | |
# get graph access token for current user --need Global admin | |
$accessTokenInformation = Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com" | |
$token = $accessTokenInformation.Token | |
# Create a new service prinicpal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AllSites.FullControl | |
User.Read.All | |
TermStore.ReadWrite.All | |
ServiceHealth.Read | |
ActivityFeed.Read | |
Team.Create | |
TeamsAppInstallation.ReadWriteForUser | |
ChannelMember.ReadWrite.All | |
TeamMember.ReadWrite.All | |
TeamSettings.ReadWrite.All |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Online.SharePoint.TenantAdministration; | |
using Microsoft.SharePoint.Client; | |
using Newtonsoft.Json.Linq; | |
using OfficeDevPnP.Core; | |
using OfficeDevPnP.Core.Framework.Provisioning.Model.Configuration; | |
using OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers; | |
using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tenant = "tenant.onmicrosoft.com" | |
# Create Azure AD app | |
$psa = Initialize-PnPPowerShellAuthentication -ApplicationName TestTeamsApp -Tenant $tenant -Store CurrentUser | |
# Connect to SPO+Graph using certificate authentication | |
Connect-PnPOnline "https://tenant-admin.sharepoint.com/" -Tenant $tenant -ClientId $psa.AzureAppId | |
-Thumbprint $psa.'Certificate Thumbprint' | |
# Store the extracted template somwhere | |
Get-PnPTenantTemplate -Out "TeamTemplate.xml" -Configuration "ExtractTeam.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://aka.ms/sppnp-extract-configuration-schema", | |
"tenant": { | |
"teams": { | |
"teamSiteUrls": ["https://your-tenant-name.sharepoint.com/sites/HRTeam"], | |
"includeGroupId": false, | |
"includeMessages": false | |
} | |
}, | |
"handlers": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Online.SharePoint.TenantAdministration; | |
using Microsoft.SharePoint.Client; | |
using Newtonsoft.Json.Linq; | |
using OfficeDevPnP.Core; | |
using OfficeDevPnP.Core.Framework.Provisioning.Connectors; | |
using OfficeDevPnP.Core.Framework.Provisioning.Model; | |
using OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers; | |
using OfficeDevPnP.Core.Framework.Provisioning.Providers; | |
using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml; | |
using System; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-PnPOnline "https://<tenant-name>.sharepoint.com/" -Scopes "User.ReadWrite.All" | |
Apply-PnPTenantTemplate -Path .\AddAzureADUser.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2019/09/ProvisioningSchema" | |
Author="Blade runner" | |
Generator="Human being ?" | |
Version="1.0" | |
Description="A sample Provisioning document" | |
DisplayName="Sample Provisioning" | |
ImagePreviewUrl="https://sharepointpnp.com/ImagePreview.png"> | |
<pnp:Preferences Author="Blade runner" Version="1.0" Generator="Human being, am I ?"> | |
<pnp:Parameters> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
AuthenticationManager authenticationManager = new AuthenticationManager(); | |
using (ClientContext clientContext = authenticationManager.GetSharePointOnlineAuthenticatedContextTenant("https://tenant-admin.sharepoint.com/", "userName", "password")) | |
{ | |
var tenant = new Tenant(clientContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-PnPOnline "https://<tenant>-admin.sharepoint.com" | |
Apply-PnPTenantTemplate -Path .\PnPUserProfileTemplate.xml |
NewerOlder