Skip to content

Instantly share code, notes, and snippets.

View pankajsurti's full-sized avatar

Pankaj pankajsurti

View GitHub Profile
#Execute Read-Host once and comment out
#Read-Host "Enter password" -AsSecureString | ConvertFrom-SecureString | Out-File "C:\Temp\passwordNEW.txt"
$TenantName="CRM106438" # Change to your tenant name
$Username = $("admin@{0}.onmicrosoft.com" -f $TenantName)
$Password = cat "C:\Temp\passwordNEW.txt" | ConvertTo-SecureString
$Creds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password
Connect-MicrosoftTeams -Credential $Creds
Connect-ExchangeOnline -Credential $Creds
Connect-SPOservice -url $("https://{0}-admin.sharepoint.com" -f $TenantName) -Credential $Creds
Connect-Msolservice -Credential $Creds
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true)]
[ValidateNotNullOrEmpty()]
[Alias("FileName")]
[string]$FileName2Process
)
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
branches:
include:
- '*'
paths:
parameters:
# unique name of the job
job_name: deploy_sppkg
# friendly name of the job
display_name: Upload & deploy *.sppkg to SharePoint app catalog
# agent pool details (default: MSFT hosted Ubuntu)
pool: Default
# vmImage: ubuntu-latest
# name of target enviroment deploying to
target_environment: ''
parameters:
# unique name of the job
job_name: deploy_sppkg
# friendly name of the job
display_name: Upload & deploy *.sppkg to SharePoint app catalog
# agent pool details (default: MSFT hosted Ubuntu)
pool: Default
# vmImage: ubuntu-latest
# name of target enviroment deploying to
target_environment: ''
parameters:
# unique name of the job
job_name: build_package
# friendly name of the job
display_name: SPFx production build & packaging
# agent pool details (default: MSFT hosted Ubuntu)
pool: Default
# vmImage: ubuntu-latest
# relative path to the project root if not in root of repo
working_directory: '.'
clear
# Application (client) ID, secret, tenant name and site
$tenantPrefix = "M365x162783";
$clientId = "ca2a60c7-d09a-4875-841b-117a02b504fd"; #client-app
$clientSecret = "A------- blah- blah--eGX_soM7SEiKAhe"; TODO
$tenantName = $tenantPrefix +".onmicrosoft.com";
$tenantDomain = $tenantPrefix +".sharepoint.com";
$sitePath = "https://M365x162783.sharepoint.com/sites/lbtest1"
$siteName = $sitePath.Split("/")[4]
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# get the PFX secret from the key vault
$tenantPrefix = "M365x162783"; # replace with your tenant id TODO to replace
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# get the PFX secret from the key vault
$tenantPrefix = "M365x162783"; # replace with your tenant id TODO to replace
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"BodyForAzureFunction": {
"inputs": {
"Action": "@{triggerBody()?['GrantRevoke']?['Value']}",
"ClientAppID": "@{triggerBody()?['ApplicationID']?['Value']}",
"DisplayName": "@{triggerBody()?['ApplicationID_x003a_AppName']?['Value']}",
"Permission": "@{triggerBody()?['ReadWrite']?['Value']}",