Showing posts with label Office365. Show all posts
Showing posts with label Office365. Show all posts

Facebook at Work provisioning using "built-in" Azure SCIM

Facebook at Work (https://work.fb.com/) is the business variant of Facebook. This gives enterprises the possibility to own, manage and use Facebook in a Enterprise context. As Facebook at Work is born in the cloud it comes with modern API's for user manangement and also exists in the Microsoft Azure Marketplace (link).

When integrating Facebook at Work into Azure you get two pre-built options from Microsoft;

  • Single Sing On (using Azure AD)
  • User Provisioning (using a pre-built Azure AD SCIM connector to facebook)

Configure Single Sign On


Below is a short guide for setting up Single Sign On between Facebook and Azure AD:

  1. Create a Azure AD user (with email) facebook@yourdomain.com
  2. Create a Facebook user with username facebook@yourdomain.com
    (make this user a global admin)
  3. Logon to Facebook at Work and Azure with your newly created users
    (there will be a match check when setting up
  4. Logon to your Facebook at Work instance
    1. Community Center > Settings
    2. Note down information under SAML configuration
      • Audience URL
      • Recipient URL
      • ACS URL
  5. Open Azure AD
    1. Add Azure application: Facebook  at Work
    2. Assign the Azure facebook@yourdomain.com as a user to Facebook at Work app
    3. Setup SSO
      1. Sign on URL = Tenant URL for Facebook (https://yourcompany.facebook.com)
      2. Identifier = Audience URL (from above)
      3. Reply URL = ACS URL (from above)
      4. Certificate; create a new 3 year certificate
      5. Store information from Azuire
        • Download the certificate file
        • Note down the SAML SSO URL
        • Note down the SAML Issure URI
  6. Back to the Facebook at Work
    1. Community > Settings
    2. SSO settings
      1. Change to SSO logon: SSO Only
      2. Expire setting: 3 weeks
      3. Certificate = Open the cert-file downloaded and paste the text
      4. SAML URL = SAML SSO URL from Azure
      5. SAML Issuer URI = SAML Issuer URI from Azure
      6. Click "TEST SSO"
        SSO should now work and be successful. Save settings. Remember that now must all authentication go through the Azure AD (not possible with multiple authentication providers in Facebook at Work at the moment). 
  7. Back to Azure AD (finish the settings)
    1. Add a notification email (for errors on certificate)

SCIM provisioning

It's also easy to setup SCIM provisioning to Facebook. 
  1. Logon to Facebook at Work
    1. Community > Settings
      1. Note down Access token
      2. Note down SCIM URL
      3. Note down Community ID
  2. Azure AD > Applications > Facebook at Work > Configure
    1. Setup provisioning
      1. User Security Token = Facebook Access token
      2. Facebook at Work Tenant URL = SCIM URL
    2. Test the connection
    3. Setup notification email (for errors on provisioning)

Username vs. E-mail address

Facebook as a cloud service provider expects that the users logon name and e-mail address are the same (at the moment). In a standard configuration Azure will create users with [UserPrincipalName] and expect these to work. You can suppressEmail (however not recommended as the service uses e-mail for driving engagement and remind users to check posts in Facebook AtWork).

E-mail invitation 

When new users are provisioned by Azure (using the SCIM integration) the service will send a invite e-mail to the newly provisioned user. This is to quickly get the user onboarded and active on the Facebook AtWork social platform.

Prevent e-mail invitation (and e-mail communication): Facebook at Work have a property suppressEmail that will stop Facebook from sending e-mails to the user. 

SuppressEmail

This is possible to configure using the Azure provisioning engine. The settings are changed in the Azure > Applications > Facebook AtWork > Attributes > Provisioning:

To add the "SuppressEmail" click on "add attribute mapping", choose "suppressEmail" (in the Facebook AtWork attribute) and then you have two options.

  • Suppress all email communications for all users (using Constant = true)
              
  • Suppress email communications for e-mail less users - no mail attribute in Azure AD(and allow for users with mail)
            


    This will check the mail attribute on the users in Azure AD, if present set suppressEmail to "false" and if blank set it to "true". My little piece of magic! 

Office 365 Clutter stuff

What is Clutter ?
Clutter is an email filtering option available to Office 365 customers.  It is similar to an anti-spam filter as it moves less important email (based on your reading habits) into a 'Clutter' folder where they can be ignored or reviewed later.  Most of the mail going into the folder should be bulk mail (advertisements) and messages from mailing lists.  However, you will want to periodically check the Clutter folder as it may move legitimate email into this folder.

When is Clutter applied ? 
Messages are handled in the following way in Exchange online:

  1. Message are scanned by Exchange online protection (EOP)
  2. Message rules in the tennant/Exchange online
  3. If the mail gets to the user mailbox
    1. Junk e-mail filtering
    2. Mailbox rules (if a message is handled by a rule clutter processing will not happen)
    3. Clutter processing


Disable Clutter (as a user)
It's possible to disable Clutter per user. Just follow the guide below:

  1. Log into OWA
  2. Click on the Gear > Options > Automatic Processing > Clutter
  3. Select Don't separate items identified as Clutter 
  4. Click Save.

Disable Clutter for the company (using a transport rule) ?
Create a new transport rule and use the following header/vaule to bypass Clutter for that e-mail:

  • HeaderName X-MS-Exchange-Organization-BypassClutter
  • Value true

Links



Remove "orphaned" meetings in RoomMailboxes

When users are leaving the company there should be a "phase out" routine to be followed with different IT tasks to be perfomed (below is just an example);
  • Log and revoke system access and permissions
  • Hand over data to manager and/or other owners
  • Delete all other data (mail, home folders, etc)
  • Cancel meetings (and/or transfer them to other responsible organizers)
However sometimes users that have left the company haven't canceled meetings and you need to remove the bookings from the RoomMailboxes (or EquipmentMailboxes) in Exchange.
Powershell to the rescure:
# Define email to search for
# Requirements
# Connection to Exchange (online) using Powershell
# Administrator account with "Mailbox Import Export" role in Exchange (online)

# Task flow
# Lookup primary email address for user
# Search meetingrooms for meetings (if needed)
# Delete meetings from meetingrooms (backup if needed)

#Search in Powershell (output in console)                               
get-mailbox -recipienttype roommailbox | search-Mailbox  -SearchQuery 'From:user@domain.com AND kind:meetings' -EstimateResultOnly -Verbose | ft identity,success,resultitemscount

#Search in Powershell (output to targetmailbox)                               
get-mailbox -recipienttype roommailbox | foreach { search-Mailbox $_.alias -SearchQuery 'From:user@domain.com AND kind:meetings' -Verbose -TargetMailbox Administrator -TargetFolder "SearchAndDeleteLog" -LogOnly -LogLevel Full }

#Delete                
get-mailbox -recipienttype roommailbox | search-Mailbox  -SearchQuery 'From:user@domain.com AND kind:meetings' -DeleteContent -Force -Verbose

#Delete (with moving messages) - enter correct targetmailbox and folder
get-mailbox -recipienttype roommailbox  |  foreach { search-Mailbox $_.alias -SearchQuery 'From:user@domain.com AND kind:meetings' -DeleteContent -Force -Verbose -TargetMailbox Administrator -TargetFolder "BackupFolder" -loglevel Full }

Office 365 - convert a deleted mailbox to a inactive mailbox

In Office 365 you can convert mailboxes for old employees to inactive mailboxes. This will preserver the mailbox in Office 365 (and can later be connected and/or searched with eDiscovery).
 .
  • Put an active mailbox on LitigationHold
    Set-Mailbox rikardst -LitigationHoldEnabled $true
  • Remove LitigationHold
    Set-Mailbox rikardst -LitigationHoldEnabled $false
  • Convert a deleted mailbox to inactive (put it on LitigationHold)
    • First assign a license to the user
    • Then put it on LitigationHold
      Set-Mailbox rikardst -LitigationHoldEnabled $true
    • Wait 60 minutes
    • Remove license
You cannot place LitigationHold on a deleted object (thats why you need to assign a license first).



Links


OneDrive for Business (web interface)

Just a quick reminder for the old and new interface URL's:

  • OLD interface
    • https://domain-my.sharepoint.com/personal/user/_layouts/15/start.aspx
  • NEW interface
    • https://domain-my.sharepoint.com/personal/user/_layouts/15/onedrive.aspx

Remember that soon will the new OneDrive for Business sync client be available. Get in line for the preview: https://preview.onedrive.com/sync 

Remove a Office 365 User/Mailbox from all distribution lists

Remove all groups on a user with Powershell;
# Get the correct mailbox
$mbx = ( Get-Mailbox UserPrincipalName )

# Process all DistributionGroups and if mailbox is member remove (with simple console output)
foreach ($group in Get-DistributionGroup -ResultSize unlimited) {
 if ((Get-DistributionGroupMember $group.identity | select -Expand distinguishedname) -contains $mbx.DistinguishedName){
  write-host "Removing user from" $group.name
  Remove-DistributionGroupMember $group.name -member $mbx.DistinguishedName -BypassSecurityGroupManagerCheck -confirm:$false
 }
}

Azure AD Sync behind proxy

To be able to have Azure AD Sync (AADSync) behind a proxy it must allow unauthenticated proxying (i.e. no ID/PWD). If you can fulfill this then you need to do the following:
  1. Configure the proxy server
  2. Configure AADSync to use the proxy server
Configure the proxy server
Do configuring to allow traffic to Office 365 IP's and URL's.

Configure AADSync
If you have a static ID/PWD for the service account then use the following command:
runas /user:domain\serviceuser "control.exe inetcpl.cpl"

In some cases you also need to edit the machine.config for .Net framework 4.5
  1. Open C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
  2. Add proxy settings (case sensitive XML)
Example on proxy settings
<system.net>
<defaultProxy>
<proxy usesystemdefault="true" proxyaddress="http://proxy-ip:80" bypassonlocal="true" />
</defaultProxy>
</system.net>
Reference: 
Sometimes you also need to set winhttp using NetSh
set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*.contoso.com"
NetSh commands

Create signing and encryption certificate that lasts 100 years in Windows 2012R2 server

Create signing and encryption certificate that lasts 100 years in Windows 2012R2 server;
Set-ADFSProperties -CertificateDuration 36500 -AutoCertificateRollover $true
Update-AdfsCertificate -CertificateType Token-Decrypting -Urgent
Update-AdfsCertificate -CertificateType Token-Signing -Urgent
Set-ADFSProperties -AutoCertificateRollover $false 

Hide/Show Mail icon in Control Panel on Remote Desktop/Citrix for Office 365 ProPlus

In Remote Desktop and Citrix environments it's common to hide specific Control Panel applets or maybe only show a few using GPO's : User Configuration\Administrative Templates\Control Panel

  • Hide specified Control Panel items
  • Show only specified Control Panel items


  • When I deployed Office 365 ProPlus (with shared licensing) on the Remote Desktop server my Mail icons disappeared from users Control Panel. The new name to use are:

    Get UPN Suffix for all users in Office 365 (Powershell)

    Get UPN Suffix for all users in Office 365 (Powershell);
    # Connect Office 365
    Connect-MsolService
    
    # Get all users 
    $users = get-msoluser -all
    
    # Create array
    $upnlist=@()
    
    foreach ($i in $users)
       {
            $s = $i.UserPrincipalName.tostring()
            $upn  = $S.substring($s.IndexOf("@"))
            $upnlist+=$upn
       }
    
    # Output
    $upnlist | Group-Object
    

    Change schedule on AADSync for Office 365

    By default the AADSync (link) runs every 3 hours on the AADSync server. This is defined by the scheduled task that is created during the installation.

    To change the synchronization interval I did the following:

    1. Add "SYSTEM" to AADSyncAdmins group
    2. Create a new scheduled task (to be run as SYSTEM)
      1. Trigger: Run it once (and set repeat to every 15 minutes and run indefinitely)
      2. Action: "C:\Program Files\Microsoft Azure AD Sync\Bin\DirectorySyncClientCmd.exe"
    3. Reboot server
    4. Run task once manually

    Azure Automation workflow to set Exchange permissions

    Azure Automation workflow to set Exchange permissions (Azure Automation compatible);
    # Change log
    # v1    Standard script                         20.04.2015
    # v2    Edited use of Automation credentials    21.04.2015
    
    workflow MailboxPermissions {
    
    # Fetch Automation credentials from RunBook Settings
    $cred = Get-AutomationPSCredential -Name "ServiceAdmin"
    
        # Use inlineScript to run a standard powershell script
        inlineScript {
            # To reuse variables outside inlineScript must use $using:variables
            # https://technet.microsoft.com/en-us/library/jj649082.aspx
     
            # Start Session to Exchange online (notice backtick char for wrapping)
            $Session = New-PSSession -ConfigurationName Microsoft.Exchange `
            -ConnectionUri https://ps.outlook.com/powershell/ `
            -Credential $Using:cred `
             -Authentication Basic -AllowRedirection
            Import-PSSession $Session
      
            # Get all user mailboxes
            $mbx = get-mailbox | where { $_.recipienttypedetails -eq 'usermailbox' }
      
            # Set permissions on mailboxes for service account or group
            $mbx | add-mailboxpermission -user "serviceadmin@domain.com" -AccessRights FullAccess 
        }
    }
    
    

    Upload files to SPOnline using Powershell (Win2008R2)

    Upload files to SPOnline using Powershell (Win2008R2):
    #Specify tenant admin and site URL
    #Requires Sharepoint license and access to site/doclib
    $User = "user@tennant.onmicrosoft.com"
    $password_clear_text = "MyPassword" 
    $SiteURL = "https://tennant.sharepoint.com/sites/projectX"
    $Folder = "C:\FilesToUpload"
    $DocLibName = "Shared Documents"
    
    #Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
    # SharePoint Online CSOM - http://www.microsoft.com/en-us/download/details.aspx?id=42038
    # WMF 3.0                - http://www.microsoft.com/en-us/download/details.aspx?id=34595
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
    
    # Use clear text password to authenticate
    $Password = ConvertTo-SecureString $password_clear_text -AsPlainText -Force 
    
    #Bind to site collection
    $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
    $Context.Credentials = $Creds
    
    #Retrieve list
    $List = $Context.Web.Lists.GetByTitle($DocLibName)
    $Context.Load($List)
    $Context.ExecuteQuery()
    
    #Upload file
    Foreach ($File in (dir $Folder -File))
    {
    $FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open)
    $FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation
    $FileCreationInfo.Overwrite = $true
    $FileCreationInfo.ContentStream = $FileStream
    $FileCreationInfo.URL = $File
    $Upload = $List.RootFolder.Files.Add($FileCreationInfo)
    $Context.Load($Upload)
    $Context.ExecuteQuery()
    }
    

    Error installing Office 2016 trial | Error: 0-1012 (0)

    Today I had trouble installing Office 2016 trial on my Windows 10 computer. When trying to run the installation I got the error message stating:
    Error: 0-1012 (0)
    I did the following to resolve the issue:

    1. Uninstalled all previous versions of Office applications
    2. Ran the "offscrubc2r.vbs" in the Office 2016 package
      ..\Uninstall\Troubleshoot\offscrubc2r.vbs
    3. Restarted the computer
    4. Ran the installation "ProPlus_en-us_x64.bat" again
      ..\Install_en-us\ProPlus_en-us_x64.bat
    Impressions so far:

    • All applications are working
    • Outlook is very slow switching between mail and calendar
    • Excel crashes sometimes during CTRL+mouseclicking

    Find all UPN suffixes used in a Active Directory (PSH)

    Very short script for fetching all UPN-suffixes used in a Active Directory using ADWS:
    Import-Module ActiveDirectory
    $users = get-aduser -filter * -properties UserPrincipalName  | where {  $_.userprincipalname -ne $null }
    $upnlist=@()
    foreach ($i in $users)
    {
    $s = $i.UserPrincipalName.tostring()
    $upn  = $S.substring($s.IndexOf("@"))
    $upnlist+=$upn
    }
    $upnlist | Group-Object
    

    Find large items in user mailboxes (Exchange 2013)

    Sometimes you need to find mailboxes with large items. This is a one liner powershell for finding mailboxes with a messages larger than a value in Exchange 2013.
    get-mailbox -resultsize unlimited | Get-MailboxFolderStatistics -IncludeAnalysis | `
     where { $_.topSubjectSize -gt 25MB } | select identity,topsubjectsize | `
     Export-Csv -Path .\LargeItems.csv -Encoding Unicode
    
    This one liner finds items in folders in user mailboxes larger than 25MB. There can however be several items large than 25MB as the command only finds the largest.
    A report for finding and reporting individual items will be a later issue.

    Uninstall DirSync fails with "Administrator privileges are required to run installer. Please re-launch installer with administrator privileges."

    There seems to be a bug with uninstaller of Mcrosoft Forfront Identity Manager Synchronization Service). Even if running "run as administrator" the uninstaller stops with the error message:
    Administrator privileges are required to run installer. Please re-launch installer with administrator privileges.

     Steps to solve

    1. Find the uninstall string from registry
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C9139DEA-F758-4177-8E0F-AA5B09628136}
    2. Open a "run as administrator" command prompt
    3. Run the command in registry string "UninstallString"
    4. Click "Remove"



    Microsoft DirSync (for Office 365) sync interval

    You can have need to change the synchronization interval for DirSync. Do the following:

    1. Stop the two services for DirSync
      • Forefront Identity Manager Synchronization Service
      • Windows Azure Active Directory Sync Service
    2. Open the directory where DirSync is installed
      Normally C:\program files\Microsoft Online Directory Sync\
    3. Open the file Microsoft.Online.DirSync.Scheduler.exe.Config
    4. Change the value for SyncTimeInterval (below is every 10 minutes)
         
    5. Save the file
    6. Start the service
    Default value is every 3 hours. I recommend to set this value to every 15 minutes in a test environment (maximum 1000 objects). For production environments I recommend every 1 hour.