top of page
treehadponoco

Office 365 – Manage Exchange Online with PowerShell: Everything You Need to Get Started



New-PSSession : outlook.office365. com Connecting to remote server outlook. office365. com failed with the following error message: Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ... + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed


New-PSSession : [outlook.office365. com] Processing data from remote server outlook.office365. com failed with the following error message: Fail to create a runspace because you have exceeded the maximum number of connections allowed: 10 for the policy party: MaxConcurrency. Please close existing runspace and try again.




Office 365 – Manage Exchange Online with PowerShell



Have you ever wanted to manage your Exchange Online environment without PowerShell? If your answer is YES, then try AdminDroid Exchange Online reporting and auditing tool. This tool offers 170+ reports on mailbox info, mailbox usage, email activity, mailbox permission, mailbox auditing, etc.


Additionally, AdminDroid provides 1500+ pre-built reports to manage all the Office 365 services like Azure AD, Exchange Online, SharePoint Online, Microsoft Teams, OneDrive for Business, One Note, Stream, etc., with few mouse clicks.


Core Microsoft Teams settings, such as policies for meetings, used to be managed with the Skype for Business Online PowerShell module. The module retired in February 2021, and the same functionality is built-in to the Teams PowerShell module. The old Skype for Business Online cmdlets are included in the Microsoft Teams V2.0 module.


Before considering PowerShell specifically in the context of Exchange Online, why should admins consider using PowerShell in general? Today, PowerShell has quickly become one of the most popular and fully-featured scripting languages. Many software vendors are developing and releasing their own PowerShell modules, allowing admins to control, configure, and manage many different solutions across the board with the familiar PowerShell syntax.


PowerShell is also very extensible. As mentioned, third-party software vendors can write their own PowerShell snap-ins and modules to integrate into the PowerShell framework, allowing PowerShell to be customized to work with many different software solutions. Third-party vendors are not the only ones that have extensively used Powershell modules and cmdlets. Most modern Microsoft software and cloud solutions have their own PowerShell modules, allowing for seamless automation, including configuration and management.


GUI management tools do not scale well when dealing with tasks that may need to be performed on multiple users or other objects. Also, what if you need to carry out specific tasks on hundreds of objects on a schedule? GUI management tools are not suited for doing this. For example, can you imagine manually changing an attribute on hundreds of Exchange Online users through the GUI? It would be extremely time-consuming and not very efficient.


This article is intended to share a streamlined approach for managing Office 365 services via PowerShell which are pertinent to the Microsoft UC platform, namely Exchange Online, Skype for Business Online, and Microsoft Teams. Covered are a host of one-time installation steps needed to prepare a single workstation with the requisite software as well as the individual PowerShell cmdlets repeatedly used to invoke access to each service when management processes need to be run.


The following cmdlets can be issued individually to establish connections into each desired online service via PowerShell. Due to the way that the Exchange module functions though it is critical to use the Exchange PowerShell module to start with as that module cannot be utilized in a standard PowerShell window.


Now that the module is installed we can move forward with connecting to Exchange Online. Use the command below to connect to exchange online. This command uses modern authentication and works for MFA or non enable MFA accounts.


However I would now like to try using a managed identity instead so that the solution is more robust. Since the Function already has a managed identity ("AuditO365"), I'd like to replace the current user account with this identity in the custom role group in Exchange Online above, but it appears that O365 can't see the managed identity! All the Azure resources and O365 are running under the same account/subscription.


Azure Active Directory can be used to manage Exchange online mailboxes, distribution lists, and mail-enabled security groups. The Azure Active Directory connector uses Exchange Online PowerShell Module through IQService to support this feature.


Visual Studio Code (VS Code) is not only a development environment but allows the use of shells such as PowerShell, the command line, and Linux Bash. This approach has several advantages: You can use multiple shells in a single window and thus manage Exchange Online with PowerShell, as well as Linux shells, and manage other services on the network in parallel with PowerShell.


Exchange Online PowerShell refers to an administrative interface that allows you to manage Microsoft Exchange Online organization with the PowerShell (command line). With this tool, you can do many daily tasks easily and quickly. For instance, you can this interface to configure mail flow/transport rules and connectors.


One thing to remember is that when working with any Move Requests via CSV, the CSV file is not a hard limit. Just because a move was created using one CSV files, does not mean that a Move Request cannot be suspended, deleted, resumed or reported by another. In other words, if there are 25 names in a CSV file at creation, we can create a brand-new CSV files with 15 names or maybe 50 names to manage. Each Move Request is totally independent of each other. So make adjustments as needed, because you will.


Recently I have had a few conversations about the new Microsoft 365 Defender capabilities for allowing and blocking mail. To keep your organization safe, you may know that Microsoft does not allow lists or filtering bypass for any mail message identified as either malware or high confidence phishing. An example of where this becomes a problem is if you use an external service for simulated phishing attacks within the organization. The external party sends controlled phishing emails to the organizations from a specific IP address and specific domains. Yet, they are still blocked by Exchange online even with rules to allow them.


Using Get-AcceptedDomain as a test, we can now see if we are able to use the managed identity that is tied to the automation account to connect to exchange online via PowerShell. My Runbook has the following code


Historically, if you had a hybrid Active Directory environment with Exchange Online, where all your user identities are synchronised with Azure AD Connect, you would not be able to manage user recipient attributes in Exchange online or on-premise, unless you had a full Exchange server in your environment.


Now (on 20/04/2022) Microsoft have released an update that will allow you to only have install the Exchange PowerShell Management tools on-premise, allowing you to manage all Exchange online user attributes without having to install a full Exchange server on-premise.


There you have it! You have now shutdown your Exchange server and are able to management recipients on your management server. It is worth noting that you will only be able to use PowerShell to manage your recipients with the plugin, so make sure you brush up on them PowerShell skills!


Thanks for sharing. I have written a script, which can generate 6 different calendar permission report based on your requirement. -calendar-permissions-report-for-office365-mailboxes-powershell/


The default Office 365 maximum message size for messages is 25MB. Since email text is usually shorter, this setting essentially restricts maximum attachment size. You can change the maximum message size for an individual mailbox with the Office 365 Admin Center or PowerShell. Here I have discussed two methods of how to increase mail attachment size in Office 365 exchange online, you can use any one of them.


First off, it is extremely easy to use a managed identity within your Runbook, once it is supported by the PowerShell modules that you use. Currently Az.Accounts is the only one that I have been using.


There are many ways to work with Microsoft Graph API. I prefer the PowerShell SDK when working with the Microsoft Graph API in a Runbook since it will make it much leaner and less prone to errors than invoking web requests. Still, as mentioned earlier, support for managed identity is missing at the time of writing this.


If the objects are synced from on-premise to online, then the objects could only be managed on-premise.If you would like to manage the objects online, then it should be the online-only object (not synced). 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page