Skip to content

Commit 6760b9d

Browse files
Update create-hub-site-with-powershell.md (#10200)
* Update create-hub-site-with-powershell.md - Updated authentication section to use modern method: Connect-PnPOnline with -Interactive and -ClientId - Deprecated -UseWebLogin method marked and discouraged - Linked to official PnP guidance on Entra ID App registration * update timestamp & markdown --------- Co-authored-by: Andrew Connell <[email protected]>
1 parent 6aada33 commit 6760b9d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/features/hub-site/create-hub-site-with-powershell.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
title: Create SharePoint hub sites using PowerShell
33
description: Example code for creating a SharePoint hub site by using PowerShell.
4-
ms.date: 08/24/2022
4+
ms.date: 04/23/2025
55
ms.localizationpriority: high
66
---
77

88
# Create SharePoint hub sites by using PowerShell
99

1010
If you're a global or SharePoint admin in Office 365, you can convert any existing site to a hub site by using Microsoft PowerShell. In this example, you'll learn how to create a SharePoint hub site and to associate another site with it. In this scenario, you are setting up sites for the Contoso marketing department:
11+
1112
- You will create a hub site that all other marketing sites will be associated with.
1213
- You will then specify settings and permissions for the hub site.
1314
- Finally, you will create a second site and associate it with the hub site.
@@ -28,10 +29,10 @@ The samples below can be performed using [PnP PowerShell](https://www.powershell
2829

2930
First, we will create the marketing site that will serve as a hub site that other sites can associate with. The intent is that any sites that are marketing-oriented will be part of the hub site. This applies common navigation and branding across the associated sites, enables team members to search across all the sites associated with the single hub site, and takes advantage of other hub site features.
3031

31-
1. Connect to the SharePoint Online Admin center using:
32+
1. Connect to the SharePoint Online Admin center using interactive login and [registered Azure AD (Entra ID)](https://pnp.github.io/powershell/articles/registerapplication.html) application:
3233

3334
```powershell
34-
Connect-PnPOnline -Url https://contoso-admin.sharepoint.com -UseWebLogin
35+
Connect-PnPOnline -Url https://contoso-admin.sharepoint.com -Interactive -ClientId <your-client-id>
3536
```
3637
3738
1. Create the site to be used as a hub site using the [New-PnPSite](https://pnp.github.io/powershell/cmdlets/New-PnPSite.html) cmdlet:

0 commit comments

Comments
 (0)