Download presentation
Presentation is loading. Please wait.
Published byDennis King Modified over 6 years ago
1
+ GETTING STARTED WITH POWERSHELL FOR OFFICE 365 Vlad Catrinescu
My First Template GETTING STARTED WITH POWERSHELL FOR OFFICE 365 Vlad Catrinescu +
2
Thank you to our sponsors for making this possible!
Platinum Sponsors Gold Sponsors Silver Sponsors
3
About Vlad Catrinescu THE KEY IS ALWAYS YOU! absolute-sharepoint.com
Office Servers and Services mvp SharePoint MVP since 2013 Product Evangelist Working for Valo Intranet Pluralsight Author Creating video content for one of the most popular and best quality online training sites. THE KEY IS ALWAYS YOU! There are many variations of passages of lorem ipsum available, but the majority have suffered alteration in some form, by injected humour Author Author of the book “Deploying SharePoint 2016” & “Essential PowerShell for Office 365” for Apress @vladcatrinescu absolute-sharepoint.com
4
Agenda My First Template Office 365 Admin Tools Users and Licensing
SharePoint Online PowerShell for Office 365 So let’s see what we will be talking about today. First, before even talking PowerShell for Office 365, we will look at some PowerShell tips and tricks that will be good anytime you script. We will then start with Office 365 Users and Licensing, then continue to the Out of the box Commandlets of SharePoint Online. Afterwards we will look at PowerShell for Exchange Online, then step it up a bit and look at some Advanced Scripting. We will look at how to do scripts that interact with more than one office 365 system, and how do we use CSOM for SharePoint online as well as Community Extensions. Lastly, we will have a Q&A period, however, as you probably know this is a pre recorded session , so you can ask all the questions you want in the chat, and I will try to answer them right away! OfficeDev PnP Exchange Online Questions
5
Office 365 Admin Tools Office 365 Admin Center Office 365 Admin App
PowerShell for Office 365 Office 365 Management API Before talking about PowerShell, let’s talk at a higher level about administering Office There are four main tools that you can use to manage Office 365. The first and most popular one is the Office 365 Admin Center. The second is the Office 365 Admin App for your mobile device. Third option is PowerShell for Office 365 and lastly we have the Office 365 Management APIs. Let’s look at each one of them in more details.
6
Office 365 Admin Center Out-of-the-box solution Users Exchange
SharePoint Skype for Business The O365 Admin Center is a web based portal that allows you to manage your tenant and everything that touches your Users, Exchange, SharePoint, as well as Skype for Business. As an Office 365 Administrator, this is the tool that you are probably the most familiar with. The Office 365 Admin Center is an Out of the box solution that is meant to be simple for the Office 365 Admin to setup and support Office 365.
7
Office 365 Admin App On-the-go Solution Edit Users Reset Passwords
Service Health Support Tickets The Office 365 Admin app allows the Office 365 administrator to stay connected with his Office 365 environment on the go. You can now manage your users including resetting their passwords. In addition, you can also read the latest messages from Message Center, the central location for Office 365 service communications view the service health status and see your support tickets. This isn’t a full management tool and is the tool that has the least options between the four that we talked about, and it’s only meant for quick fixes or changes while on the go.
8
PowerShell for Office 365 Automation Advanced functions
The third tool, and the one we will focus on in this course is PowerShell for Office 365. PowerShell is an incredibly powerful tool that if you're not already using it and you're a Systems Administrator you will want to make it a priority. If you are an Office 365 Administrator, it’s even more important to know PowerShell in order to be able to automate tasks as well as get access to advanced functions. Since in Office 365, Microsoft does not give you access to the backend management software, some configurations are only available via PowerShell.
9
Office 365 Management API Programmatic access Innovate on top
Lastly, we have the Office 365 Management API. The management API can be used by developers to create apps that will sit on top of Office 365 and make administration easier and offer more features.
10
Azure Active Directory
11
The Azure Active Directory module is hosted on the PowerShell Gallery
The PowerShell Gallery is the central repository for PowerShell content from Microsoft To download modules, you need PowerShellGet How do we get it? The Azure Active Directory Module module is hosted on the powerShell Galaery. The PowerShell Gallery is the central repository for PowerShell content from Microsoft. To download modules from the PowerShell Gallery you need to have PowerShell Get
12
Minimum Requirements PowerShellGet PowerShellGet is included with:
Windows 10 or newer Windows Server 2016 or newer Windows Management Framework (WMF) 5.0 or newer PowerShell 6 PowerShellGet You might already have PowerShell get installed on your computer, depending on what operating system or PowerShell version you have. PowerShell Get is included automatically If you are using Windows 10 or later, Windows Server 2016 or later, if you have installed the Windows Management Framework 5.0 or later, or if you have PowerShell version 6.
13
Minimum Requirements PowerShellGet
If you have an older version of Windows / PowerShell Download the PackageManagement MSI us/download/details.aspx?id=51451 PowerShellGet If you do not have those operating systems don’t worry, you can download the PackageManagement MSI at the link in the slides.
14
Installing the Module Install-Module -Name AzureAD
After you have the requirement, you simply need to run the Install-Module cmdlet, and specify the name of the cmdlet which is AzureAD
15
Connecting to Azure Active Directory
Global administrator role in Azure AD Now that we have the module, we need to connect to Azure Active Directory. You of course need your username and password, as well as as Global Admin rights in Azure Active Directory.
16
Connecting to Azure Active Directory
$cred = Get-Credential Connect-AzureAD -Credential $cred You first need to run a Get-Credential cmdlet, and save the credential in a variable called cred. Afterwards, we will run the Connect-AzureAD cmdlet, and specify the credential parameter, and the credential we just saved!
17
Connecting to Azure Active Directory with MFA
Different steps if you have Multi Factor Authentication (MFA) enabled However, if your company is using Multi Factor Authentication, the procedure is just a little bit different!
18
Connecting to Azure Active Directory with MFA
Connect-AzureAD Because with MFA we cannot save the credential an automatically connect, we need to simply run Connect Azure AD, which will open up a pop up where you will enter your username, password and it will prompt you for the second authentication method!
19
Azure AD PowerShell Module Stable, production release
Azure AD PowerShell Module – Public Preview Latest features, not always well documented Subject to change before getting in the production release Before continuing on to the next modules, I just wanted to talk a bit about the fact that there are actually two modules for Azure AD. The first one , which we just played with, is the Stable, Production release of the PowerShell Module. The second one, called the Azure AD PowerShell Module, Public Preview includes the latest features, that are not yet in the production release. They get in that module sometimes quite a few months before , however they are not as well documented, and might change before getting into the production release!
20
Installing the Module Install-Module -Name AzureADPreview
The full module name in PowerShell Gallery is the Axure Active Directory PowerShell for Graph , Public Preview release.. Or to install it you just need to know it’s module name which is AzureADPreview. To install it , simply call the Install-Module, with the name AzureADPreview! Make sure you uninstall the prod version of the Azure AD Module if you’re going to install the preview version.
21
Getting the AzureAD PowerShell Module
Connecting to Azure Active Directory with PowerShell Basic cmdlet Demos Let’s go to the lab, and see how it looks like in real lifer when we connect to Azure Acttive Directory with PowerSHell, both with simple authentication and multi factor authentication!
22
SharePoint Online
23
The SharePoint Online module is hosted on the Microsoft Download Center
ca/download/details.aspx?id=35588 Unlike the AzureAD Powershell module which is on the PowerSHell Gallery, the SharePoint Online module is hosted on the Microsoft download center , and you can either search for it using your favorite search engine, or download those slides from Pluralsight, and copy the link from the slides!
24
Requirements SharePoint Online Administrator
URL of SharePoint Online Admin Center name>-admin.sharepoint.com You also need to be an SharePoint Online Administrator in order to be able to connect, and know the URL of the SharePoint Online admin center, which is always in the form of https organization name - admin.sharepoint.com
25
Connecting to SharePoint Online
#Get Connection Credential $cred = get-credential #Establish Connection Connect-SPOService -Url Admin Center>.sharepoint.com -credential $cred You need to open up the SharePoint Management Shell, or a normal PowerShell window and import the SharePoint Online Module, then get the credential, and save it in a variable, and finally Establish the connection using the Connect-SPOService cmdlet, specifying the URL of the SharePoint Online admin center! You can view in this case, the URL of my SharePoint Online Admin center would be Globomantics.org-admin . Sharepoint.com
26
Connecting to SharePoint Online with MFA
#Establish Connection Connect-SPOService -Url Admin Center>.sharepoint.com #Follow the instructions in the Microsoft SharePoint Online Management Shell dialog box to provide the additional authentication information. If you are using Mutli Factor Authentication, you need to run the Connect-SPOService PowerShell cmdlet, and then you will have a web login, or a pop up opening up in which you will be able to enter your username, password as well as second form of authentication!
27
Connecting to SharePoint Online with PowerShell Basic Cmdlets Demos
Let’s now go to the lab, and see it in a demo how to get the SharePoint Online PowerShell Module , connect to SharePoint Online using PowerShell with both simple authentication and multi factor authentication
28
Open source initiative coordinated by SharePoint engineering
Contains multiple best-practices samples One of them is the SharePoint / Office 365 Dev PnP PowerShell Cmdlets Contains over 250 PowerShell cmdlets Can do a lot more than the SharePoint Online PowerShell Module The Office 365 Dev PnP , which stands for patterns and Practices is an open source initiative by the Sharepoint engineering group at Microsoft, which contains multiple solutions, best practices and samples on how to do more with Office 365, and SharePoint. One of the awesome solutions is the SharePoint and Office 365 Dev PnP PowerShell cmdlets, which include over 250 PowerShell cmdlets that can do a lot more than the Microsoft provided SharePoint Online PowerSHell module!
29
The SharePoint / Office 365 Dev PnP PowerShell module is hosted on the PowerShell Gallery
Same prerequisites as the AzureAD PowerShell module seen earlier in this module How do we get it? PnP PowerShell module module is hosted on the powerShell Galaery. The PowerShell Gallery is the central repository for PowerShell content from Microsoft. We have already learned about the prerequisites to get stuff from the PowerSHell Gallery earlier in this module, so we will not go over them again!
30
Installing the Module Install-Module -Name SharePointPnPPowerShellOnline After you have the requirement, you simply need to run the Install-Module cmdlet, and specify the name of the cmdlet which is SharePointPnPPowerShellOnline.
31
Connecting to SharePoint Online using the PnP Module
SharePoint Online Admin Site Collection Admin to only manage a select site collection URL of a site collection in your tenant / SPO Admin Center To connect, you need to be a SharePoint Online Admin in order to manage things at the tenant level, like for example create a new Site Collection. You can also simply be a Site Collection Admin if you only want to manage only a single Site Collection, and lastly you need the URL of the Site Collection you want to manage, or the URL of the SPO admin center if you want to manage tenant level settings..
32
Connecting to SharePoint Online using the PnP Module
$cred = Get-Credential Connect-PnPOnline –Url –Credentials $cred To connect with Simple authentication, you simply get the credential, then run the Connect-PnPOnline cmdlet, specify the URL of the Site Collection you want to connect to if you want to only manage a Site Collection, or the Admin Center for any Admin level settings, and alstly specify the credentials!
33
Connecting to SharePoint Online using the PnP Module with MFA
Connect-PnPOnline –Url –UseWebLogin If we have Multi Factor Authentication authentication, we need to run the same Connect-PnPOnline PowerShell cmdlet, specify the site we want to connect to, and then use the Useweblogin parameter ,which will open up the pop up required so we can enter our username and password, as well as second authentication method.
34
Connect to SharePoint Online using the PnP PowerShell Module
Basic Cmdlets Demos Now that we’ve seen the theory, let’s go to the lab and see it in real life!
35
Exchange Online
36
Requirements Exchange Online Admin
To connect to Exchange Online, you need to be an Exchange Online Admin, and if you do not have MFA.. That is about it! Don’t need to download anything at all!
37
Connecting to Exchange Online
#Get Connection Credential $cred = get-credential #Establish Connection $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $cred -Authentication Basic -AllowRedirection #Add remote Session into current session Import-PSSession $Session Forst. Getting the credential is done with the Get-Credential command we already learned. We then need to establish the connection. For Exchange Online, we actually do a remote PowerShell session so we will run the new PSSession command, giving it the Configuration Name , Connection URL, Credential, Authentication and specifying the Allow Redirection . The Connection URL is always outlook.office365.com/powershell-liveid except in two small exception about which we will talk a bit later. We will then import the PSSession we just created and then we can start using the commands.
38
Office 365 operated by 21Vianet (China)
ConnectionUri: Office 365 Germany ConnectionUri liveid/ The exceptions for the ConnectionURI is if you are on an Office 365 tenant operated by 21Vianet in China, you would use the COnnectionURI specified in the slides over here, and the Office 365 Germany ConnectionURI parameter is also a bit different!
39
Connecting to Exchange Online with MFA
Different steps if you have Multi Factor Authentication (MFA) enabled What about Multi Factor authentication? Well, Exchange Online has quite some different steps if you’re using MFA.
40
You need to download the Exchange Online PowerShell Module
First of all, you need to download a module, from the Exchange Online Admin Center in order to connect with multi factor authentication.
41
And you need to be using Internet Explorer
Chrome or other browsers will throw out an error And very importantly , you need to use the good old Internet explorer to download it, or else it will not work, and you will get a beautiful error as seen in the slides!
42
Connecting to Exchange Online with MFA
Connect-EXOPSSession -UserPrincipalName In order to connect, with this ne wmodule, we actually use a different cmdlet than without MFA, we are using Connect-EXOPSSession, and pass the User Principal Name. This will open a pop up where we can enter the rest of our authentication information.
43
Connecting to Exchange Online Germany with MFA
Connect-EXOPSSession -UserPrincipalName -ConnectionUri AzureADAuthorizationEndPointUri If you’re connecting to Office 365 Germany with Multi Facotr Authentication, you will also need to specify the ConnectionUri as well as the AzureADAuthorizationEndPointUri parameters for it to work!
44
Connecting to Exchange Online with PowerShell
Basic Exchange Online Cmdlets Now that we saw the theory, let’s go to the lab and see it in the demo environment!
45
Resources Pluralsight PowerShell for Office 365 Portal
My First Template Resources Pluralsight PowerShell for Office 365 Portal Hey, Scripting Guy! Blog PnP-PowerShell First, some shameless self promotion , one resource to learn PowerShell for Office 365 is my upcoming Pluralsight course which will be over two hours of PowerShell for Office 365 awesome, other than what we covered today, we will go more in detail with Commandlets, we will cover Skype for Business as well the Office 365 compliance center and more examples and more of everything! Make sure you follow me on twitter and my blog to find out when its released! Second, the PowerShell for Office 365 portal that you can find at PowerShell.office.com . The PowerShell for Office 365 portal is a website owned by Microsoft where they publish lots of tips and tricks as well as sample scripts for PowerSHell & Office 365. Third , the Hey Scripting Guy Blog. It’s a great blog and they post a lot of how tos on PowerShell, not only Office 365, but PowerShell in general. Chances are that if you google or bing something about PowerShell, sooner or later you will be on that site! Lastly, the PNP PowerSHell from the OfficeDev Patterns and Practices. I think that community extension will be greater and greater since that site is heavily encouraged by Microsoft, and you should find a lot of great ressources on there.
46
Thank you! @vladcatrinescu http://ca.linkedin.com/in/vladcatrinescu
11/24/2018 7:56 PM Thank you! @vladcatrinescu pluralsight.com/authors/vlad-catrinescu © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
47
Resources / Scripts
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.