1.Download and install the latest SharePoint Online Management Shell.
2.Connect to SharePoint as a global admin or SharePoint admin in Microsoft 365.
Check the SharePoint Online Management Shell by running the following command in administrative mode in PowerShell.
Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version
3.If your operating system is using PowerShell 5 or newer, you can also install the SharePoint Online Management Shell by running the following command in administrative mode.
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
4.To ensure you have all available cmdlets, you should always make sure the module is up to date. You can update the SharePoint Online Management Shell by running the following command in administrative mode.
5.To connect with a user name and password, run the following command at the SharePoint Online Management Shell command prompt.
Connect-SPOService -Url https://contoso-admin.sharepoint.com -Credential email@example.com
When prompted with the Windows PowerShell credential request dialog box, type the password for the SharePoint admin account.
6.To connect with multifactor authentication (MFA), run the following command at the SharePoint Online Management Shell command prompt.
Connect-SPOService -Url https://contoso-admin.sharepoint.com
When prompted with the Microsoft SharePoint Online Management Shell dialog box, type the account name and password for a SharePoint administrator account, and then click Sign in..
Follow the instructions in the Microsoft SharePoint Online Management Shell dialog box to provide the additional authentication information, such as a verification code, and then click Sign in.
7.Run the following command.
Set-SPOSite <SiteURL> -DenyAddAndCustomizePages 0
If you change this setting for a user’s OneDrive or a classic team site, it will be overridden by the Custom Script setting in the admin center within 24 hours.
Author: Cary Sun
Cary Sun has a wealth of knowledge and expertise in data center and deployment solutions. As a Principal Consultant, he likely works closely with clients to help them design, implement, and manage their data center infrastructure and deployment strategies.
With his background in data center solutions, Cary Sun may have experience in server and storage virtualization, network design and optimization, backup and disaster recovery planning, and security and compliance management. He holds CISCO CERTIFIED INTERNETWORK EXPERT (CCIE No.4531) from 1999. Cary is also a Microsoft Most Valuable Professional (MVP), Microsoft Azure MVP, Veeam Vanguard and Cisco Champion. He is a published author with several titles, including blogs on Checkyourlogs.net, and the author of many books.
Cary is a very active blogger at checkyourlogs.net and is permanently available online for questions from the community. His passion for technology is contagious, improving everyone around him at what they do.
Blog site: https://www.checkyourlogs.net
Web site: https://carysun.com
Blog site: https://gooddealmart.com
Amazon Author: https://Amazon.com/author/carysun