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
Get-PnPProvisioningTemplate -Out "<Folder location in drive>" | |
-ExcludeHandlers ApplicationLifecycleManagement, SiteSecurity | |
-ExcludeContentTypesFromSyndication |
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
$cred = Get-Credential | |
Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com" -Credential $cred | |
# get a reference to the site collection where the | |
# site collection app catalog should be created | |
$site = Get-SPOSite https://contoso.sharepoint.com/sites/marketing | |
# create site collection app catalog | |
Add-SPOSiteCollectionAppCatalog -Site $site |
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
public SecureString GetSecret() | |
{ | |
try | |
{ | |
// Get the Secret Uri from Key Vault | |
string SecretUri = System.Environment.GetEnvironmentVariable("<KeyValutSecretUri>"); | |
var kvToken = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(GetToken)); | |
var kvSecret = kvToken.GetSecretAsync(SecretUri).Result; | |
SecureString secpass = new SecureString(); | |
foreach (char charpass in kvSecret.Value) |
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
$userPass = $env:EncryptedPass | |
$keyPath = 'D:\home\site\wwwroot\<FunctionName>\bin\<PasswordFileName>.key' | |
$secPass = $userPass | ConvertTo-SecureString -Key (Get-Content $keyPath) |
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
## Create an Encrypted Password ## | |
$AESKey = New-Object Byte[] 32 | |
[Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($AESKey) | |
Set-Content C:\Temp\<PasswordFileName>.key $AESKey | |
## Run the above code first, then upload the above file to the Function App## | |
Function Get-EncryptedPassword | |
{ | |
param ( |
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
$credentials = Get-Credential | |
Connect-PnPOnline "https://<your-tenant>.sharepoint.com/sites/<target-site>" -Credentials $credentials | |
## You can use the following PnP cmdlet | |
## ClientSideComponentId from Manifest.Json of the extension | |
Add-PnPCustomAction -Name "<CommandSetName>" -Title "<CommandSetTitle>" -Description "<Text>" -RegistrationId "101" -RegistrationType List -ClientSideComponentId "<Id from Manifest.json>" -Location "ClientSideExtension.ListViewCommandSet" |
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
private string appJsonInfo; | |
private AppDeclaration Apps; | |
// A class to hold JSON converted objects for Apps | |
private class AppDeclaration | |
{ | |
public string appName; | |
public string appId; | |
public string clientsideId; | |
} |
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.SharePoint.Client; | |
using OfficeDevPnP.Core.ALM; | |
using OfficeDevPnP.Core.Pages; | |
using OfficeDevPnP; | |
public void DeploySingleApp(Guid appId) | |
{ | |
using (ClientContext context = new ClientContext(<SiteUrl>)) | |
{ | |
context.Credentials = new SharePointOnlineCredentials(UserName, SecurePass); |