This file contains hidden or 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
Param( | |
[Parameter(Mandatory=$true)] | |
[string]$CredentialName, | |
[Parameter(Mandatory=$true)] | |
[string]$SiteUrl, | |
[Parameter(Mandatory=$true)] | |
[string]$TemplateName, | |
[Parameter(Mandatory=$true)] | |
[string]$StorageAccountName, | |
[Parameter(Mandatory=$true)] |
This file contains hidden or 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
# Requires Connect-MsolService connection to have made before running script | |
Param( | |
[Parameter(Mandatory = $true)] | |
[string]$AppPrincipalId | |
) | |
<# | |
Get App Principal Id | |
#> | |
$app = Get-MsolServicePrincipal -All | Where-Object -FilterScript { ($_.AppPrincipalId -eq $AppPrincipalId) } |
This file contains hidden or 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
Add-Type -Path "C:\Program Files\WindowsPowerShell\Modules\SharePointPnPPowerShell2019\3.9.1905.3\OfficeDevPnP.Core.dll" | |
[Reflection.Assembly]::LoadFile("C:\Program Files\WindowsPowerShell\Modules\SharePointPnPPowerShell2019\3.9.1905.3\OfficeDevPnP.Core.dll") | |
# PS> Add-PnPClientSideWebPart -Page $homepage -Component "Web Part Name" | |
# A PR has been raised to enable this cmdlet in the main PnP-PowerShell module for SP2019 | |
# See https://github.com/SharePoint/PnP-PowerShell/pull/2250 | |
Function Add-PnPClientSideWebPart(){ | |
Param( |
This file contains hidden or 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
o365 login -t password -u $(username) -p $(password) | |
$apps = o365 teams app list -o json | ConvertFrom-Json | |
$app = $apps | Where-Object { $_.externalId -eq $env:APPID} | |
if ($app -eq $null) { | |
# install app | |
o365 teams app publish -p $(System.DefaultWorkingDirectory)/teams-app-CI/package/teams-app.zip | |
} else { | |
# update app | |
o365 teams app update -i $app.id -p $(System.DefaultWorkingDirectory)/teams-app-CI/package/teams-app.zip |
This file contains hidden or 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
$manifest = Get-Content -Path $(System.DefaultWorkingDirectory)/teams-app-CI/package/teams-app/manifest.json | ConvertFrom-Json | |
$appId = $manifest.id | |
Write-Host "##vso[task.setvariable variable=appId;]$appId" | |
Write-Host "Set environment variable to $($env:APPID)" |
This file contains hidden or 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
o365 login -t password -u $(username) -p $(password) | |
app=$(o365 teams app list -o json | jq '.[] | select(.externalId == "'"$APPID"'")') | |
if [ -z "$app" ]; then | |
# install app | |
o365 teams app publish -p "$(System.DefaultWorkingDirectory)/teams-app-CI/package/teams-app.zip" | |
else | |
# update app | |
appId=$(echo $app | jq '.id') |
This file contains hidden or 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
o365 login -t password -u $(username) -p $(password) | |
$themes = o365 spo theme list -o json | ConvertFrom-Json | |
$themes | ForEach-Object { | |
o365 spo theme remove -n $_.name --confirm | |
} |
This file contains hidden or 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
o365 login -t password -u $(username) -p $(password) | |
themes=$(o365 spo theme list -o json) | |
for theme in $(echo $themes | jq '.name'); do | |
o365 spo theme remove -n $theme --confirm | |
done |
This file contains hidden or 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
pwsh -NoLogo | |
o365 login | |
$token = o365 accesstoken get -r https://graph.microsoft.com --new | |
$request = Invoke-WebRequest -Uri https://graph.microsoft.com/v1.0/me -Headers @{"Authorization"="Bearer $token"} | |
$request.Content | ConvertFrom-Json |
This file contains hidden or 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
<# | |
.SYNOPSIS | |
Assign Application Role to Azure Active Directory service principal | |
.DESCRIPTION | |
This script helps assign Application Roles from existing resources to Azure Active Directory service principals, useful for assigning roles to Managed Identity service principals which cannot be performed through the Azure Portal | |
.PARAMETER ResourceName | |
The name of the service principal that has the app role that you want to assign |