You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/hub-site/create-hub-site-with-powershell.md
+22-18Lines changed: 22 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -9,16 +9,16 @@ ms.date: 2/26/2018
9
9
> [!IMPORTANT]
10
10
> The hub sites feature is currently in preview and is subject to change. It is not currently supported for use in production environments.
11
11
12
-
If you're a global or SharePoint admin in Office 365, you can convert any existing site to a hub site using Windows PowerShell. In this example, learn how to create a SharePoint hub site, and associate another site with it. The scenario is that you are setting up sites for the Contoso marketing department. You will create a hub site that all other marketing sites are associated with. Then you will create a second site to associate with the hub site. You will also specify settings and permissions for the hub site.
12
+
If you're a global or SharePoint admin in Office 365 you can convert any existing site to a hub site using Windows 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. You will create a hub site that all other marketing sites will be associated with. Then you will specify settings and permissions for the hub site. Finally, you will create a second site and associate it with the hub site.
13
13
14
-
To work with this example in SharePoint online, we recommend using a developer tenant and not your production tenant. All of the steps use a fictional tenant named "Contoso" which you can replace with your own tenant name.
14
+
To work with this example in SharePoint online, we recommend using a developer tenant and not your production tenant. All of the steps below use a fictional tenant named "Contoso" which you can replace with your tenant name.
15
15
16
16
## Connect to SPO
17
17
18
-
First you need to get connected to SharePoint Online using Windows PowerShell. The commands use both the [SharePoint Online Management Shell](https://www.microsoft.com/en-us/download/details.aspx?id=35588) (-SPO) and [SharePoint PnP PowerShell Online module](https://www.powershellgallery.com/packages/SharePointPnPPowerShellOnline) (-PnP).
18
+
First, you need to connect to SharePoint Online using Windows PowerShell. The commands use both the [SharePoint Online Management Shell](https://www.microsoft.com/en-us/download/details.aspx?id=35588) (-SPO) and [SharePoint PnP PowerShell Online module](https://www.powershellgallery.com/packages/SharePointPnPPowerShellOnline) (-PnP).
19
19
20
20
1. Start Windows PowerShell
21
-
2. Run the [Connect-SPOService](https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/connect-sposervice) cmdlet to connect to SharePoint online. Log in with your global admin credentials.
21
+
2. Run the [Connect-SPOService](https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/connect-sposervice) cmdlet to connect to SharePoint online. Log in with your global or SharePoint admin credentials:
@@ -28,22 +28,24 @@ In the remainder of this exercise, "contoso" will be used as the tenant name. Co
28
28
29
29
## Create a new hub site
30
30
31
-
Create the Marketing site. The marketing site will also be a hub site that other sites can associate with. The intent is that any sites that are marketing oriented can be part of the hub site. Then team members can search across all the sites associated with the single hub site, apply common navigation and branding, and take advantage of other hub site features.
31
+
Next, 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 will apply common navigation and branding across the associated sites, enable team members to search across all the sites associated with the single hub site, and take advantage of other hub site features.
32
32
33
-
1. Create the site using the [New-PnPSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/new-pnpsite) cmdlet.
33
+
1. Create the site using the [New-PnPSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/new-pnpsite) cmdlet:
34
34
35
35
```PowerShell
36
-
Connect-PnPOnline -SPOManagementShell # this reuses the credentials you logged in with Connect-SPOService
36
+
Connect-PnPOnline -SPOManagementShell
37
37
New-PnPSite -Type TeamSite -title "Contoso marketing division" -alias "marketing" -Description "Main site for collaboration for marketing teams at Contoso"
38
38
```
39
39
40
-
The cmdlet will return the URL of the new site:
40
+
>The `-SPOManagementShell` parameter allows you to reuse the credentials you logged in with using the `Connect-SPOService` cmdlet.
41
+
42
+
The cmdlet will return the URL of the new site similar to the following:
41
43
42
44
```
43
45
https://contoso.sharepoint.com/sites/marketing
44
46
```
45
47
46
-
2. Register this marketing site as a hub site using the [Register-SPOHubSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/register-spohubsite.md) cmdlet.
48
+
2. Register the new marketing site as a hub site using the [Register-SPOHubSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/register-spohubsite.md) cmdlet:
The hub site doesn't have a logo or description yet. Also we want to constrain it so that only one person can make changes to the hub site.
68
+
The hub site doesn't have a logo or description yet. We also want to constrain it so that only one person can make changes to the hub site.
69
+
70
+
### Set properties
67
71
68
-
1. Upload a logo image to use. Go to https://contoso.sharepoint.com/sites/marketing/SiteAssets and upload any image you like. Make a note of the image file name.
69
-
2. Use the [Set-SPOHubSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spohubsite) cmdlet to set the logo and description. In place of "mylogo.jpg" specify the name of the image you uploaded.
72
+
1. Upload a logo image for the site by going to _https://contoso.sharepoint.com/sites/marketing/SiteAssets_ and uploading any image you like. Make a note of the image file name.
73
+
2. Use the [Set-SPOHubSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spohubsite) cmdlet to set the logo and description. In place of "mylogo.jpg" specify the name of the image you uploaded:
70
74
71
75
```PowerShell
72
76
Set-SPOHubSite -Identity https://contoso.sharepoint.com/sites/marketing -LogoUrl https://contoso.sharepoint.com/marketing/SiteAssets/mylogo.jpg -Description "Main hub site for collaboration on marketing activities across Contoso"
@@ -84,11 +88,11 @@ Description : Main hub site for collaboration on marketing activities across Con
84
88
Permissions :
85
89
```
86
90
87
-
## Set permissions
91
+
###Set permissions
88
92
89
93
Now we will restrict access so that only the user nestorw@contoso can make changes to the hub site associations.
90
94
91
-
- Run the [Grant-SPOHubSiteRights](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/grant-spohubsiterights) cmdlet to grant a user rights to the marketing hub site. We'll use nestorw@contoso but you can use any valid user on your tenant for this example.
95
+
- Run the [Grant-SPOHubSiteRights](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/grant-spohubsiterights) cmdlet to grant a user rights to the marketing hub site. We'll use nestorw@contoso in this example, but you can use any valid user on your tenant (you can specify multiple users by separating them with a comma):
2. Associate this site with the hub site using the [Add-SPOHubSiteAssociation](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/add-spohubsiteassociation) cmdlet
129
+
2. Associate this site with the hub site using the [Add-SPOHubSiteAssociation](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/add-spohubsiteassociation) cmdlet:
You can run the [Get-SPOHubSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/get-spohubsite) cmdlet to confirm, or you can log in to SharePoint Online and view the hub site directly at https://contoso.sharepoint.com/sites/marketing. The hub site nav will appear at the top of the site. If you go to the https://contoso.sharepoint.com/sites/online-advertising site, it will also show the same hub site nav at the top.
137
+
You can run the [Get-SPOHubSite](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/get-spohubsite) cmdlet to confirm, or you can log in to SharePoint Online and view the hub site directly at https://contoso.sharepoint.com/sites/marketing. The hub site navigation will appear at the top of the site. If you go to the https://contoso.sharepoint.com/sites/online-advertising site, it will also show the same hub site navigation at the top.
0 commit comments