Multi-factor authentication (MFA) with PowerShell

May 31, 2019

The use of multi-factor authentication (MFA) is growing by the day. More and more customers are enabling MFA for administrator accounts to protect their cloud environment a little bit more. But that also might affect your PowerShell scripts. In this post I want to point out how to deal with MFA enabled accounts in your PowerShell script.
Solution:
SharePoint Patterns and Practices (PnP) contains a library of PowerShell commands (PnP PowerShell) that allows you to perform complex provisioning and artifact management actions towards SharePoint. The commands use CSOM and can work against both SharePoint Online as SharePoint On-Premises.

Installation

There are 3 ways to install the cmdlets. We recommend, where possible, to install them from the PowerShell Gallery. Alternatively you can download the setup files or run a PowerShell script to download the PowerShellGet module and install the cmdlets subsequently.

PowerShell Gallery

If you main OS is Windows 10, or if you have PowerShellGet installed, you can run the following commands to install the PowerShell cmdlets:

SharePoint Version Command to install
SharePoint Online Install-Module SharePointPnPPowerShellOnline
SharePoint 2019 Install-Module SharePointPnPPowerShell2019
SharePoint 2016 Install-Module SharePointPnPPowerShell2016
SharePoint 2013 Install-Module SharePointPnPPowerShell2013

Notice: if you install the latest PowerShellGet from Github, you might receive an error message stating

PackageManagement\Install-Package : The version ‘x.x.x.x’ of the module ‘SharePointPnPPowerShellOnline’ being installed is not catalog signed.

In order to install the cmdlets when you get this error specify the -SkipPublisherCheck switch with the Install-Module cmdlet, e.g. Install-Module SharePointPnPPowerShellOnline -SkipPublisherCheck -AllowClobber

 
Trick for MFA Script:
Connect-PnPOnline
Module:

sharepoint-pnp

Applies to:

SharePoint Server 2013, SharePoint Server 2016, SharePoint Online

Connect to a SharePoint site

PowerShell Copy

Connect-PnPOnline

-Url <String>

-UseWebLogin [<SwitchParameter>]

[-ReturnConnection [<SwitchParameter>]]

[-MinimalHealthScore <Int>]

[-RetryCount <Int>]

[-RetryWait <Int>]

[-RequestTimeout <Int>]

[-CreateDrive [<SwitchParameter>]]

[-DriveName <String>]

[-Scopes <String[]>]

[-TenantAdminUrl <String>]

[-SkipTenantAdminCheck [<SwitchParameter>]]

[-IgnoreSslErrors [<SwitchParameter>]]

[-NoTelemetry [<SwitchParameter>]]

 

-UseWebLogin

If you want to connect to SharePoint with browser based login. This is required when you have multi-factor authentication (MFA) enabled.

Type: SwitchParameter
Position: Named
Accept pipeline input: False
Accept wildcard characters: False

 

Click below to read more….
Powershell and Office 365-POC Guidelines-ByCognitiveConvergenceTeam-Blog

Advertisements

Investigating – debugging/diagnostics tools for Office 365

January 31, 2019

Investigating – debugging/diagnostics tools for Office 365

Experience in using Fiddler:

  1. Fiddler trace logs for MFA in Office 365 and Azure AD
  2. Working with Office 365 REST API with Fiddler
  3. track down a network problem with Office365 using Fiddler
  4. Using Fiddler for Autodiscover troubleshooting scenarios
  5. Getting Fiddler to work with SharePoint Online
  6. Using Fiddler to troubleshoot Lync Mobile Client
  7. using fiddler rule to get outlook to authenticate to the Microsoft online
  8. Troubleshooting interactions with Office Online
  9. Troubleshooting Mobile Devices Connectivity with Fiddler

Experience in using procmon

  1. Using Procmon To Find Registry Settings
  2. Process Monitor for standard log and for bootlog
  3. Troubleshooting Outlook COM Addins
  4. To generate a log file for an application

Experience in using  SARA

To fix problems with Outlook and other Office 365 products

Tools:

Remote Connectivity Analyzer — now With Message Analyzer

If you don’t already know about the Remote Connectivity Analyzer, it’s a great tool for troubleshooting many common Exchange issues.

One of the coolest new features is the Message Header Analyzer.

Support and Recovery Assistant for Office 365

Support and Recovery Assistant for Office 365 can help you automatically diagnose and fix a range of Outlook problems. You will need to download the application to your local computer, sign in with your work or school account and select the issue you want help with. The Support and Recovery Assistant app can help you identify and fix several issues for the following apps and services.

  1. Office setup
  2. Outlook
  3. Outlook for Mac 2016 or Outlook for Mac 2011
  4. Mobile devices
  5. Outlook on the web for business
  6. Microsoft Dynamics CRM Online
  7. Exchange Online
  8. OneDrive for Business

Calendar Checking Tool for Outlook (CalCheck)

CalCheck is a program that checks your Outlook calendar for problems, and performs various checks on general settings, such as permissions, free/busy publishing, delegate configuration, and automatic booking. Then, each item in your calendar folder is checked for known problems that can cause unexpected behavior, such as meetings that seem to be missing.

Enjoy…Development with Office 365 and its related services.

 


Presentation-Microsoft SharePoint Framework, SPFx

September 30, 2018

Presentation

Topic: Microsoft SharePoint Framework, SPFx
Scope: basic
Level: Executive

Click here to download presentation


SharePoint 2016-CSOM-File Upload-via-ClientContext

February 27, 2018

Exception:
An unhandled exception of type 'System.Net.WebException' occurred in Microsoft.SharePoint.Client.dll Additional information: The remote server returned an error: (409) Conflict.

Code:
var clientContext = new ClientContext("http://myservername/sites/subsitename") { Credentials = LogonCredentials };
using (var fileStream = new FileStream(@"C:\Temp\Test.txt", FileMode.Open))
{
Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, "/MyDocLibraryName/Test_FromClientOM.txt", fileStream, true);
}

Reason :
• Context can be from Root site or from Sub site, does not make difference.
• Verify that Second parameter to .SaveBinaryDirect( method is right.
• API does not create a folder
• Note: Second parameter is path starting from Root Site, Not Sub site.
So ideally code should be like:
Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, “/sites/subsitename /MyDocLibraryName/MyFolderName/Test_FromClientOM.txt”, fileStream, true);

Enjoy SharePoint.


Free remote SharePoint online – Office 365 training – Part 3

January 21, 2018

Free remote SharePoint online – Office 365 training (3 sessions)
Participate in our free remote SharePoint online – Office 365 training.
First session 11/15/2017 – 6:00-8:00 PM Eastern time
The second session 11/22/2017 at 6:00 PM US Eastern time.
The third session 11/29/2017 at 6:00 PM US Eastern time.
Join the meeting:
https://join.me/aasoftech

Below are the link for the presentation-Recording:
(Third session)
https://recordings.join.me/KhYLlgbRTUSlAL8pIRA4Jg
https://recordings.join.me/NWD9_20C00a1ob_r3FTzcw

Download Third presentation from here.


Office 365 – Remote SharePoint online training course-Part-2-Overview

December 25, 2017

Free remote SharePoint online – Office 365 training (3 sessions)
Participate in our free remote SharePoint online – Office 365 training.
First session 11/15/2017 – 6:00-8:00 PM Eastern time
The second session will be on 11/22/2017 at 6:00 PM US Eastern time.
The third session will be on 11/29/2017 at 6:00 PM US Eastern time.
Join the meeting:
https://join.me/aasoftech

Below are the link for the presentation-Recording:
(Second session)
https://recordings.join.me/hRPCX2O96EWYszAcEEm46Q

Download second presentation from here.


Office 365 – Remote SharePoint online training course-Part-1-Overview

November 26, 2017

Free remote SharePoint online – Office 365 training (3 sessions)
Participate in our free remote SharePoint online – Office 365 training.
First session 11/15/2017 – 6:00-8:00 PM Eastern time
The second session will be on 11/22/2017 at 6:00 PM US Eastern time.
The third session will be on 11/29/2017 at 6:00 PM US Eastern time.
Join the meeting:
https://join.me/aasoftech

Below are the link for the presentation-Recording:
(First session)
https://recordings.join.me/DI6cXr6uI0iGhONep6DvlA

https://recordings.join.me/cGYfnzLPkEW3XJwCAPLlTA

Download presentation from here.