As an Office 365 admin, youspend most of your time in PowerShell to perform administrative tasks. Office 365 includesa wide range of cloud services such as Exchange Online, Azure Active Directory, SharePoint Online, Skype for Business Online, Teams and Security & Compliance Center.
Each Office 365 service has its own PowerShell module for creating a connection via PowerShell. If you want to work with multiple services, remember (copy and paste😉) various cmdlets and modules to manually create sessions, which is a labor-intensive and time-consuming task. And most importantly come here! MFA. Today, most administrator accounts are MFA-enabled, which requires a different approach to creating a PowerShell session.
Do not worry! We createdScript PowerShell completowhich connects all Office 365 services using PowerShell with MFA/non-MFA account. You can connect to any or all Office 365 services with just a single cmdlet.
Roadmap highlights:
- Installs the Office 365 PowerShell modules. That is, the modules required for the Office 365 services areautomatically downloaded and installedafter your confirmation.
- You mayto connectfor one or moreOffice 365 Servicesvia PowerShell using asingle cmdlet.
- You mayto connectoneOffice 365 services withMFA-enabled account.
- For a non-MFA account, noYou must enter a credential for each service.You will only be asked to enter your credential once!
- the script isfriendly programmer🇧🇷 i.e. credentials can be passed as a parameter instead of saving inside theroad map.
- You maydisconnect all servicesconnectionsusing a single cmdlet.
Script to connect all Office 365 services using PowerShell (also works for MFA)
We haveeAll in onePowerShell script to connect Office 365 services like Exchange Online, Azure AD, SharePoint Online, Skype for Business,teams,and the Compliance Center using PowerShell.
As mentioned above, each service requires a different module, we designed our script to install the necessarymodule(if not already installed) thenyour confirmation🇧🇷 If you want to download and install manually,you can follow the steps we provide inside the script.
Download script:ConnectO365Services.ps1
Now I will explain how to use our script to connect Office 365 services, with MFAywithout MFA. You can use this script to connect a single service or a combination of services. Also, you can use this script to install Office 365 PowerShell modules.
First, you need to download the above script.
connect everyoneOffice365 Services (without MFA):
Using the following cmdlet you can connect to Office 365 services likeExchange Online, Azure Active Directory, MSOnline, SharePoint Online, SharePoint PnP, Skype for Business Online, Teams e Security & Compliance Center.
Power Shell
1 | ./ConnectO365 services.ps1 |
You can also pass the credential as a parameter.
Power Shell
1 | ./ConnectO365 services.ps1 -User name Administration@Contoso.com -Clave "XXX" |
Note: You can also provide the absolute path of the script if it is not in the current directory.
Connect to all Office 365 services (with MFA):
Using the following cmdlet you can connect to Office 365 services likeExchange Online, Azure Active Directory, SharePoint Online, Skype for Business Online, Teams e Security & Compliance Center com MFA.
Power Shell
1 | ./ConnectO365 services.ps1 -AMF |
If you use an MFA-enabled account, you must enter the credential for each service.
For detailed usage of this script you can refer to theto usecases given at the bottom.
Challenges in reporting with PowerShell:
Most admins prefer PowerShell to manage their Microsoft 365 environment. But when it comes to reporting, it's always difficult to get the desired report with PowerShell. Why
- PowerShell takes a lot of effort to generate the required reports, which is time consuming.
- Automating reporting is difficult when using MFA.
- If you don't retrieve audit data properly, you will end up with data loss, which defeats the purpose.
- If you're a newbie, you might get lost finding the right cmdlet.
What if there was an easier way to generate Microsoft 365 reports? A tool likeAdminDroidwill help you report and audit your Microsoft 365 environment.
AdminDroidoffers1500+pre-designed reports and20smart analytics dashboards where you can effortlessly gain insights into your Office 365 environment. This tool provides reports on various categories like,
- Azure Active Directory information
- Online trading reports
- Online SharePoint Reporting
- Microsoft Teams Reports
- security reports
- OneDrive for Business Reports
- Skype for Business Online Reports
- Yammer reports
- transmit reports
- PowerBI Reports
- OneNote Reports
- General Office 365 reports
Additionally, AdminDroid offers100+ reports and a handful of dashboards completely free🇧🇷 Includes reports on users, licenses, groups, group memberships, devices, login activities, password changes, license changes and much more. The free edition has no restrictions on reporting functionality such as customizing, scheduling and exporting. unloadingAdminDroid's Free Office365 Reporting Tooland see how it helps you.
More use cases of "Connect all O365 Services PowerShell scripts":
- Connect all Office 365 services at once
- Connect all Office 365 services at once with MFA
- Script do PowerShell para conectar o Exchange Online PowerShell
- PowerShell Script to Connect Exchange Online to MFA
- Script do PowerShell para conectar o Office 365 PowerShell
- PowerShell Script to Connect O365 with MFA
- Script do PowerShell para conectar o Azure AD PowerShell
- PowerShell Script to Connect Azure AD PowerShell to MFA
- Script do PowerShell para conectar o SharePoint Online PowerShell
- PowerShell Script to Connect SharePoint Online to MFA
- Script do PowerShell para conectar o SharePoint PnP PowerShell
- PowerShell Script to Connect SharePoint PnP PowerShell to MFA
- PowerShell Script to Connect Skype Enterprise PowerShell
- PowerShell Script to Connect Skype for Business with MFA
- Script do PowerShell para conectar o Teams PowerShell
- PowerShell Script to Connect Teams with MFA
- Script do PowerShell para conectar o PowerShell Security & Compliance Center
- PowerShell Script to Connect Security & Compliance Center with MFA
- Connect multiple Office 365 services using PowerShell
- Disconnect all Office 365 services at once
To connectoneonline exchangeShell power:
To connect to Exchange Online, run the following cmdlet.
Power Shell
1 | ./ConnectO365 services.ps1 -Services ExchangeOnline |
For a detailed explanation of the cmdlet, seeconectarse a um Exchange Online PowerShellblog.
To connectoneTroca on-line do PowerShell com MFA:
To connect Exchange Online PowerShell with MFA, you need "Exchange Online Remote PowerShell Module" from Microsoft. Our script will install the Exchange Online MFA module (after your confirmation),when running a script with -MFAchangeand then connect Exchange Online using MFA.
Power Shell
1 | ./ConnectO365 services.ps1 -Services ExchangeOnline -AMF |
If you want to install the module manually, seeConnect Exchange Online with MFAblog.
To connectum Office 365Shell power:
To connect to the Microsoft Azure Active Directory Module for Windows PowerShell, run the following cmdlet.
Power Shell
1 | ./ConnectO365 services.ps1 -Services EM online |
Note: The above cmdlet will be installedEM onlinemodule if not already installed.
To connectan O365Power Shellusing MFA:
To connect to the Microsoft Azure Active Directory Module for Windows PowerShell with MFA, run the following cmdlet.
Power Shell
1 | ./ConnectO365 services.ps1 -Services EM online -AMF |
Note: The above cmdlet will be installedEM onlinemodule if not already installed.
To connectum Azure Active DirectoryShell power:
To connect to the Microsoft Azure Active Directory PowerShell Module for Graph, run the following cmdlet.
Power Shell
1 | ./ConnectO365 services.ps1 -Services Azure AD |
Note: The above cmdlet will install AzureADmodule if not already installed.
To connectum Azure Active DirectoryPower Shellusing MFA:
To connect to Microsoft Azure Active Directory PowerShell with MFA, run the following cmdlet.
Power Shell
1 | ./ConnectO365 services.ps1 -Services Azure AD -AMF |
Note: The above cmdlet will install AzureADmodule if not already installed.
To connect to SharePoint Online using PowerShell, you need the SharePoint Online Management Pack. When running a cmdlet below it will prompt you to install this module if it is not already installed.
Power Shell
1 | ./ConnectO365 services.ps1 -Services SharePoint -SharePointHostName <OrganizationName> |
SharePointHostNameused to connect SharePoint OnlineAdministrationCenter. Foradmin@Contoso.onmicrosoft.com, the organization name is Contoso.
To connect SharePoint Online PowerShell to an MFA-enabled account, run the following cmdlet.
Power Shell
1 | ./ConnectO365 services.ps1 -Services SharePoint -SharePointHostName <OrganizationName> -AMF |
SharePointHostNameused to connect SharePoint OnlineAdministrationCenter. Foradmin@Contoso.onmicrosoft.com, the organization name is Contoso.
SharePoint Patterns and Practices (PnP) enable you to perform complex provisioning and artifact management actions in SharePoint.
To connect SharePoint PnP using PowerShell, run the following cmdlet. It will ask you to install that module if it is not already installed.
Power Shell
1 | ./ConnectO365 services.ps1 -Services SharePointPnP -SharePointHostName <OrganizationName> |
SharePointHostNameused to connect SharePoint OnlineAdministrationCenter. Foradmin@Contoso.onmicrosoft.com, the organization name is Contoso.
To connect SharePoint PnP PowerShell with an MFA-enabled account, run a cmdlet below.
Power Shell
1 | ./ConnectO365 services.ps1 -Services SharePointPnP -SharePointHostName <OrganizationName> -AMF |
SharePointHostNameused to connect SharePoint OnlineAdministrationCenter. Foradmin@Contoso.onmicrosoft.com, the organization name is Contoso.
Sign in to Skype for BusinessPowerShell on-line:
Because the Skype for Business Online Connector module and theNew-CSOnlineSessioncmdlet are deprecated, you can use the Teams PowerShell module to manage the *-CsOnline* cmdlets.
Connect to Teams PowerShell:
To connect Teams PowerShell, you need the Microsoft Teams module. When you run the following cmdlet it will install the Microsoft Team PowerShell module and connect to Teams.
Power Shell
1 | ./ConnectO365 services.ps1 -Services teams |
Connect to Teams PowerShell with MFA:
To connect Teams PowerShell to MFA, run the following cmdlet.
Power Shell
1 | ./ConnectO365 services.ps1 -Services teams -AMF |
Conecte-se ao Office 365 Security & Compliance Center PowerShell:
To manage the Office 365 Security & Compliance Center from PowerShell, run the following cmdlet
Power Shell
1 | ./ConnectO365 services.ps1 -Services SecAndCompCenter |
Connect to the Office 365 PowerShell Security & Compliance CenterWlike MFA:
To connect the Office 365 Security & Compliance Center with MFA, you need the "Exchange Online Remote PowerShell Module" from Microsoft. Our script will install the Exchange Online MFA module (after receiving your confirmation) when you run a script with the -MFA parameter and then connect the Security & Compliance Center.
Power Shell
1 | ./ConnectO365 services.ps1 -Services SecAndCompCenter -AMF |
If you want to install the module manually, seeInstale o módulo Exchange Online Remote PowerShellblog.
Connect multiple Office 365 services using PowerShell:
If you want to hook up multiple services, mention the required services using the -Services parameter.
Power Shell
1 | ./ConnectO365 services.ps1 -Services Azure AD,ExchangeOnline |
If you want to connect multiple Office 365 services with MFA, list the required services with the -MFA switch.
Power Shell
1 | ./ConnectO365 services.ps1 -Services Azure AD,ExchangeOnline,skype -AMF |
After running the script, the connected services will be listed as shown in the following screenshot.
now you connectedto Office 365 services and can manage them through PowerShell.
Disconnect Office 365 services:
Be sure to disconnect the remote PowerShell session when finished. more youwould endusing all remote PowerShell sessions available to you and you will getanext error.
Nuevo-PSSession:perspective.office365. withProcessing data from a remote serverperspective.office365. withfailed with the following error message: Unable to create aexecution spacebecause you have exceeded the maximum number of connections allowed: 10 for the policy part:max. of concurrency🇧🇷 Close the existing onesexecution spaceand try again.
To disconnect all Office 365 PowerShell sessions in the current window, run the following command.
Power Shell
1 | ./ConnectO365 services.ps1 –disconnect |
Hope this blog can help you to create PowerShell session for Office 365 services. If you have any problem connectingction, share it with us through the comments section.
Even if you face other challenges in the Office 365 environment or need any PowerShell script related to Office 365, let us know in the comments section. Happy script!
You may also like these blogs:
FAQs
How do I connect to a PowerShell team with an MFA? ›
You'll get a popup to enter your credentials. This Popup is multi-factor authentication (MFA) aware! You can connect Microsoft Teams PowerShell with MFA by leaving the “-Credential” parameter. You can also use the credential parameter to get the username and password to connect.
How do I know if MFA is enabled in Office 365 PowerShell? ›Check MFA status in Microsoft 365 admin center
Sign in to Microsoft 365 admin center. Navigate to Users > Active Users > Multi-factor authentication. A new page will open, and it will show all the users and their multi-factor auth status. In our example, we have a couple of users MFA enabled, and MFA enforced.
The Exchange Online PowerShell module uses modern authentication and works with multi-factor authentication (MFA) for connecting to all Exchange-related PowerShell environments in Microsoft 365: Exchange Online PowerShell, Security & Compliance PowerShell, and standalone Exchange Online Protection (EOP) PowerShell.
How do I enforce an MFA for all users in Office 365? ›Watch: Turn on multifactor authentication
Go to the Microsoft 365 admin center at https://admin.microsoft.com. Select Show All, then choose the Azure Active Directory Admin Center. Select Azure Active Directory, Properties, Manage Security defaults. Under Enable Security defaults, select Yes and then Save.
- Store your Office 365 admin credentials: $UserCredential = Get-Credential.
- Connect to the Office 365 Exchange session: Import-PSSession $Session -DisableNameChecking.
- Run command to verify Modern Authentication: Get-OrganizationConfig | Format-Table Name,OAuth* -Auto.
- Connect to Azure AD PowerShell. Start Windows PowerShell and connect to Azure AD PowerShell. Connect-MsolService.
- Enable MFA Office 365 for single user. Enable MFA for a single Office 365 user. ...
- Enable MFA Office 365 for all users. Enable MFA for all Office 365 users.
- Show all MFA-enabled users that have enrolled. Get-MsolUser | Where-Object {$_.StrongAuthenticationMethods -like "*"} | select UserPrincipalName,StrongAuthenticationMethods,StrongAuthenticationRequirements.
- Enable MFA. ...
- Enable MFA for specific user. ...
- Enable MFA for all users. ...
- Disable MFA for specific user.
Use the Connect-IPPSSession cmdlet in the Exchange Online PowerShell module to connect to Security & Compliance PowerShell or standalone Exchange Online Protection PowerShell using modern authentication. The cmdlet works for MFA or non-MFA enabled accounts.
Should MFA be enabled on service accounts? ›They're normally used by back-end services allowing programmatic access to applications, but are also used to sign in to systems for administrative purposes. Service accounts like these should be excluded since MFA can't be completed programmatically.
How do you check if MFA is enabled or not? ›- In the navigation bar on the upper right, choose your user name, and then choose My Security Credentials.
- Check under Multi-factor Authentication (MFA) to see whether MFA is enabled or disabled. If MFA has not been activated, an alert symbol ( ) is displayed.
What is the difference between MFA enforced and enabled? ›
Enabled: The user has been enrolled in MFA but has not completed the registration process. They will be prompted to complete the registration process the next time they sign in. Enforced: The user has been enrolled and has completed the MFA registration process.
Can I use MFA without modern authentication? ›In Office 365, modern authentication is required for MFA.
Is modern authentication the same as MFA? ›Modern authentication in Exchange Online enables authentication features like multi-factor authentication (MFA), smart cards, certificate-based authentication (CBA), and third-party SAML identity providers. Modern authentication is based on the Active Directory Authentication Library (ADAL) and OAuth 2.0.
Is PowerShell still supported? ›PowerShell Support Lifecycle - PowerShell | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How do I bulk enforce MFA? ›Navigate to Users > All Users. Select the More option and click Multi-Factor Authentication. Here you can enable MFA for multiple users using a bulk update. You can also check the boxes next to the required user accounts and enable MFA for them.
How do you enforce MFA for all users and guests? ›To enforce MFA, you need to create an Azure AD Conditional Access policy. MFA policies are always enforced at your organization, regardless of whether the partner has MFA capabilities. A valid external email account that you can add to your tenant directory as a guest user and use to sign in.
Is MFA mandatory for all IAM users? ›IAM users using the AWS Management Console generate temporary credentials and allow access only if MFA is used. Note: IAM users using the AWS CLI with long-term credentials are denied access and must use MFA to authenticate. Therefore, be sure to use an MFA token to authenticate your CLI session.
How do I enable MFA for service account? ›- Log in to portal.azure.com using your Global Administrator credentials.
- Click Azure Active Directory under Azure services.
- Choose Security from the left pane.
- Click MFA under the Manage category in the left pane.
- Choose the Additional cloud-based MFA settings option.
...
Creating and authenticating to Azure via a service principal and client secret requires four steps:
- Build an Azure AD application.
- Create a service principal.
- Assign a role to the service principal.
- Authenticate as the service principal.
- Step 1: Create a policy to enforce MFA sign-in. Create a customer managed policy that prohibits all actions except the few IAM actions.
- Step 2: Attach policies to your test user group. ...
- Step 3: Test your user's access.
What are the three authentication methods available for MFA? ›
Three Main Types of MFA Authentication Methods
Things you know (knowledge), such as a password or PIN. Things you have (possession), such as a badge or smartphone. Things you are (inherence), such as a biometric like fingerprints or voice recognition.
- In the navigation pane, choose Users.
- In the User Name list, choose the name of the intended MFA user.
- Choose the Security credentials tab. ...
- In the Manage MFA Device wizard, choose Virtual MFA device, and then choose Continue. ...
- Open your virtual MFA app.
- PowerShell to Connect to SharePoint Online with MFA.
- Create App Password and Connect with App Password.
- Connect SharePoint Online PowerShell with MFA (Multifactor Authentication) by Omitting “Credential” Parameter.
To add an authenticated account for use with Service Management, use the Add-AzureAccount cmdlet from the Azure PowerShell module.
How do attackers bypass MFA? ›Another social engineering technique that is becoming popular is known as “consent phishing”. This is where hackers present what looks like a legitimate OAuth login page to the user. The hacker will request the level of access they need, and if access is granted, they can bypass MFA verification.
Can you brute force MFA? ›Brute Force Attacks
An attacker may manage to find a working username and password with a brute force, reverse brute force attack, or dictionary attack. However, they don't know or have the other authentication factors required by the MFA system, so they cannot access the system.
- Connect to Azure AD PowerShell. Start Windows PowerShell and connect to Azure AD PowerShell. ...
- Disable MFA Office 365 for single user. Disable MFA for a single Office 365 user. ...
- Disable MFA Office 365 for all users.
Azure AD Multi-Factor Authentication is enforced with Conditional Access policies. These policies allow you to prompt users for MFA when needed for security and stay out of users' way when not needed.
How do you enforce an MFA with conditional access? ›...
Named locations
- Under Assignments, select Conditions > Locations. Configure Yes. Include Any location. Exclude All trusted locations. Select Done.
- Select Done.
- Save your policy changes.
MFA and SSO are not mutually exclusive. As a matter of fact, you can combine these two technologies to provide your users with high security while ensuring a good user experience. MFA can add an extra layer of protection to the SSO logins of your users.
What services use MFA? ›
- Cisco Secure Access by Duo. Duo has one of the bigger footprints of any of the MFA services. ...
- IBM Security Verify. IBM Security Verify is IBM's entry into the Identity Management and MFA space. ...
- LastPass MFA. ...
- Microsoft Azure AD MFA. ...
- Okta Adaptive MFA. ...
- PingOne MFA. ...
- RSA SecurID. ...
- Yubico YubiKey.
- Multi-factor authentication takes more time. Not only does having to enter two or more forms of authentication add time to a process, but the set-up itself can be time-consuming. ...
- MFA isn't free. A business can't set up multi-factor authentication by themselves.
If the user hasn't yet registered MFA authentication methods, they receive a prompt to register the next time they sign in using modern authentication (such as via a web browser). No. Legacy authentication continues to work until the registration process is completed.
What is the difference between Office 365 MFA and azure MFA? ›Azure MFA provides more security and greater flexibility. Unlike the Office 365 MFA, it can even be enforced on hybrid deployments making it a potent solution to protect against threats emanating from various sources that target not just user accounts but an organization's infrastructure as a whole.
Can MFA be bypassed? ›Multifactor authentication provides a high level of security, but phishers, scammers and other malicious actors are highly motivated to find ways around this protection so they can steal valuable data. Hackers use techniques called MFA bypass to defeat MFA.
Which is better 2FA or MFA? ›Therefore, MFA is a more secure method than 2FA because a user must respond to more checkpoints. Especially if authentication factors disperse through different access points that aren't available online (like a token or security key) and require a physical presence.
What triggers MFA 365? ›Microsoft 365 supports MFA for user accounts using: A verification code sent as a text message to the user's phone. A phone call. The Microsoft Authenticator smartphone app.
What triggers Microsoft MFA? ›Yes, MFA would be triggered after a successful O365 primary authentication. Since you are able to verify that MFA is enabled after you sign in, it's not necessary to discuss other scenarios. If you have any further concern, we suggest you post to TechNet for dedicated assistance.
What is better than MFA? ›Passwordless authentication is typically considered faster and more convenient than MFA. Users don't have to commit passwords to memory and only have to use one method of authentication.
What is the most secure method of MFA? ›The most secure form of MFA is the security key. The security key, being a separate device altogether, won't leave your accounts unprotected in the event of a mobile phone being lost or stolen. Both the SMS-based and app-based versions would leave your accounts at risk in this scenario.
Does MFA work without Internet? ›
If you have a mobile signal, but no internet, you can authenticate via SMS instead of using a push-notification. That is why entering your mobile number as a method of authentication in addition to the Authenticator App is important. Click to return to MFA homepage.
What is the difference between MFA and adaptive MFA? ›Unlike with MFA, adaptive authentication is more dynamic, and security requirements can change according to the user role, location, or the situation. Since every employee, vendor, or partner has different access needs, capabilities, and endpoints in a given login session, IT security policies must be adaptable.
Is OAuth considered as MFA? ›OAuth 2.0 and MFA are not related to one another directly. OAuth 2.0 is an authorization protocol which provides a client application with the delegated access. Way of delegation is defined by grant type and based on the use case you can choose one or another.
How do I know if modern authentication is enabled in Office 365 Powershell? ›- Login to Microsoft 365 admin center.
- Click Settings–> 'Org Settings. '
- Select 'Modern authentication' present under the 'Services' tab.
- PowerShell requires.NET framework.
- Object-Based: With most shells, text-based commands are used to get the job done while writing scripts. ...
- Security Risks: Another potential drawback of using Windows PowerShell is that it can create some potential security risks.
Shifting Dates
The deprecation date for the Azure AD and MSOL modules is shifting. Originally, this was June 2022, then the end of 2022, and now it's June 2023. Clearly, customer feedback has told Microsoft that it's going to be difficult to update PowerShell scripts before Microsoft wants to retire these modules.
There are few differences in the PowerShell language between Windows PowerShell and PowerShell. The most notable differences are in the availability and behavior of PowerShell cmdlets between Windows and non-Windows platforms and the changes that stem from the differences between the . NET Framework and . NET Core.
How would you access Exchange Online PowerShell with an account that has MFA enabled *? ›To run PowerShell scripts with an MFA-enabled admin account against Exchange Online, you need the ExchangeOnlineManagement module, aka EXO V2. The ExchangeOnlineManagement module has all the old familiar Exchange CmdLets, so basically your old scripts will remain functional.
How do I get the QR code for MFA? ›You will be presented with an Authenticator QR code on your the next login attempt to Passportal.
How do I connect to exo PowerShell? ›You need to open the URL in a browser on any computer, and then enter the unique code. After you complete the login in the web browser, the session in the Powershell 7 window is authenticated via the regular Azure AD authentication flow, and the Exchange Online cmdlets are imported after few seconds.
How do I manage my MFA for service accounts? ›
- Log in to portal.azure.com using your Global Administrator credentials.
- Click Azure Active Directory under Azure services.
- Choose Security from the left pane.
- Click MFA under the Manage category in the left pane.
- Choose the Additional cloud-based MFA settings option.
Open the Microsoft Authenticator app on your phone. Tap the + > Work or school account. Use your phone to scan the QR square that is on your computer screen.
How can I get a two step verification code without a phone? ›If you've lost access to your primary phone, you can verify it's you with: Another phone signed in to your Google Account. Another phone number you've added in the 2-Step Verification section of your Google Account. A backup code you previously saved.
Why is Authenticator not scanning QR code? ›My Authy or Google Authenticator App won't scan the barcode. Try restarting your mobile device and begin again. If this doesn't work then try removing the scanner app (does not apply to Apple iOS) and reinstalling it. Restart the mobile device and try scanning the barcode again.
How do I connect Intune to PowerShell? ›- Install-Module -Name Microsoft. Graph. Intune.
- Get-InstalledModule -name Microsoft. Graph. Intune.
- Connect-MSGraph -AdminConsent.
- Connect-MSGraph.
- On the Hyper-V host, open Windows PowerShell as Administrator.
- Use the Enter-PSSession cmdlet to connect to the virtual machine. ...
- Type your credentials for the virtual machine.
- Run whatever commands you need to.
Open an elevated Windows PowerShell command prompt (run Windows PowerShell as an administrator). Run the Install-Module MSOnline command. If you're prompted to install the NuGet provider, type Y and press Enter. If you're prompted to install the module from PSGallery, type Y and press Enter.