Skip to content

Instantly share code, notes, and snippets.

View arjancornelissen's full-sized avatar

Arjan Cornelissen arjancornelissen

View GitHub Profile
@arjancornelissen
arjancornelissen / O365DNSrecords.zone
Last active June 17, 2018 16:31
Office 365 DNS records
; Exchange Online
@ 3600 IN MX 0 <domain selector>.mail.protection.outlook.com.
autodiscover 3600 IN CNAME autodiscover.outlook.com.
@ 3600 IN TXT "v=spf1 include:spf.protection.outlook.com -all"
; Skype for Business
sip 3600 IN CNAME sipdir.online.lync.com.
lyncdiscover 3600 IN CNAME webdir.online.lync.com.
_sip._tls.<domain name>. 3600 IN SRV 100 1 443 sipdir.online.lync.com.
_sipfederationtls._tcp.<domain name>. 3600 IN SRV 100 1 5061 sipfed.online.lync.com.
@arjancornelissen
arjancornelissen / ExportDNSZone.py
Created June 17, 2018 16:13
Azure CLI Export DNS zone file
az network dns zone export -g <resource group> -n <zone name> -f currentzone.zone
@arjancornelissen
arjancornelissen / ImportDNSZone.py
Last active June 17, 2018 16:10
Azure CLI import DNS zone file
az network dns zone import -g <resource group> -n <zone name> -f o365zone.zone
@arjancornelissen
arjancornelissen / Connect-SPOAzureAutomationRunAs.ps1
Created June 9, 2018 15:06
Connect to SharePoint Online in Azure Automation with Run As account
$servicePrincipalConnection=Get-AutomationConnection -Name "AzureRunAsConnection"
$appsecret = Get-AutomationVariable -Name "SPAppSecret"
Connect-PnPOnline -AppId $servicePrincipalConnection.ApplicationId -AppSecret $appsecret -Url "https://<tenant>-admin.sharepoint.com"
@arjancornelissen
arjancornelissen / appPermissionsAppOnly.xml
Created June 9, 2018 15:01
appPermissions with AppOnly
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/Tenant" Right="Manage"/>
</AppPermissionRequests>
@arjancornelissen
arjancornelissen / Set-SPUserProfileProperty.ps1
Last active March 11, 2018 15:13
Set the SharePoint user profile property 'CellPhone'
# You need to be connected to the tenant admin site and Azure AD
$User = Get-AzureADUser -SearchString "user@mydomain.com"
Set-PnPUserProfileProperty -Account $user.UserPrincipalName -PropertyName "CellPhone" -Value $user.mobile
@arjancornelissen
arjancornelissen / SPOForceRenewalOfCT.ps1
Last active October 6, 2018 15:40
Script to force the renewal of Content Types
param
(
# give the URL of the site or when to reset for every site the admin url
[Parameter(Mandatory=$true)]
[string]$url,
# Do we need to use the weblogin
[Parameter(Mandatory=$false)]
[switch]
$useweblogin
@arjancornelissen
arjancornelissen / Check-SPOSitesPartnerAccess.ps1
Created May 13, 2017 15:20
Check if a partner as access to all site collection
$sites = Get-SPOSite -Limit All
foreach ($site in $sites)
{
Write-Output $site.Url
Get-SPOUser -Site $site.Url | Where-Object {$_.DisplayName -like "Foreign Principal*"} | Select-Object DisplayName, LoginName
}
@arjancornelissen
arjancornelissen / Check-SPOSitePartnerAccess.ps1
Created May 13, 2017 14:52
Check if a partner as access to a specific site collection
Get-SPOUser -Site https://worktogether.sharepoint.com | Where-Object {$_.DisplayName -like "Foreign Principal*"}
@arjancornelissen
arjancornelissen / Remove-AzureADDirectorySetting.ps1
Created October 30, 2016 20:44
Azure AD Directory settings Remove custom setting
Remove-AzureADDirectorySetting -ObjectId 2781a6b5-8ffc-46e2-9e59-adbc6248e56a