Skip to content

Commit 69a4ba8

Browse files
authored
Merge pull request #5242 from pnp/wobba-search-vertical-support
Add Microsoft Search vertical, result type, and site connection cmdlets
2 parents 738b0cc + 42b08bf commit 69a4ba8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+5101
-6
lines changed

documentation/Get-PnPFlow.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ Get-PnPFlow [-Environment <PowerAutomateEnvironmentPipeBind>] [-AsAdmin] [-Ident
3636
## DESCRIPTION
3737
This cmdlet returns Power Automate Flows meeting the specified criteria.
3838

39+
### Prerequisites
40+
41+
Your Entra app registration must have the `user_impersonation` delegated permission from the Azure Service Management API. To add this permission using Azure CLI:
42+
43+
```bash
44+
az ad app permission add --id <your-app-id> --api 797f4846-ba00-4fd7-ba43-dac1f8f63013 --api-permissions 41094075-9dad-400e-a0bd-54e686782033=Scope
45+
az ad app permission admin-consent --id <your-app-id>
46+
```
47+
48+
For full Power Platform access, you may also need to add permissions from:
49+
- **Dynamics CRM API** (`00000007-0000-0000-c000-000000000000`) - `user_impersonation` scope
50+
- **PowerApps Service API** - `User` scope (can be found under "APIs my organization uses" in Azure Portal)
51+
3952
## EXAMPLES
4053

4154
### Example 1

documentation/Get-PnPPowerApp.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ Get-PnPPowerApp [-Environment <PowerPlatformEnvironmentPipeBind>] [-AsAdmin] [-I
2727
## DESCRIPTION
2828
This cmdlet returns the Power Apps for a given environment.
2929

30+
### Prerequisites
31+
32+
Your Entra app registration must have the `user_impersonation` delegated permission from the Azure Service Management API. To add this permission using Azure CLI:
33+
34+
```bash
35+
az ad app permission add --id <your-app-id> --api 797f4846-ba00-4fd7-ba43-dac1f8f63013 --api-permissions 41094075-9dad-400e-a0bd-54e686782033=Scope
36+
az ad app permission admin-consent --id <your-app-id>
37+
```
38+
39+
For full Power Platform access, you may also need to add permissions from the PowerApps Service API (found under "APIs my organization uses" in Azure Portal).
40+
3041
## EXAMPLES
3142

3243
### Example 1

documentation/Get-PnPPowerPlatformEnvironment.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@ Get-PnPPowerPlatformEnvironment -Identity <PowerPlatformEnvironmentPipeBind> [-C
3232
```
3333

3434
## DESCRIPTION
35-
This cmdlet retrieves all of the Microsoft Power Platform environments for the current tenant
35+
This cmdlet retrieves all of the Microsoft Power Platform environments for the current tenant.
36+
37+
### Prerequisites
38+
39+
Your Entra app registration must have the `user_impersonation` delegated permission from the Azure Service Management API. To add this permission using Azure CLI:
40+
41+
```bash
42+
az ad app permission add --id <your-app-id> --api 797f4846-ba00-4fd7-ba43-dac1f8f63013 --api-permissions 41094075-9dad-400e-a0bd-54e686782033=Scope
43+
az ad app permission admin-consent --id <your-app-id>
44+
```
3645

3746
## EXAMPLES
3847

documentation/Get-PnPSearchExternalConnection.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ title: Get-PnPSearchExternalConnection
1313

1414
**Required Permissions**
1515

16-
* Microsoft Graph API : One of ExternalConnection.ReadWrite.OwnedBy, ExternalConnection.Read.All, ExternalConnection.ReadWrite.All
16+
* Microsoft Graph API: ExternalConnection.ReadWrite.OwnedBy, ExternalConnection.Read.All, or ExternalConnection.ReadWrite.All
1717

1818
Retrieves all connections to external datasources belonging to Microsoft Search
1919

@@ -87,4 +87,6 @@ Accept wildcard characters: False
8787
8888
## RELATED LINKS
8989
90+
[Get-PnPSearchSiteConnection](Get-PnPSearchSiteConnection.md) - Retrieves external connections via the GCS API with detailed configuration (schema, crawl settings, identity configuration). Only returns published connections available for the connected site. Use this when you need connection details for configuring search verticals with [New-PnPSearchVertical](New-PnPSearchVertical.md).
91+
9092
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPSearchResultType.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: Get-PnPSearchResultType
8+
---
9+
10+
# Get-PnPSearchResultType
11+
12+
## SYNOPSIS
13+
14+
**Required Permissions**
15+
16+
* [Graph Connector Service (GCS) API](#prerequisites)
17+
* Site scope: Site Administrator
18+
* Organization scope: Search Administrator or Global Administrator
19+
20+
Retrieves Microsoft Search result types configured for the currently connected site or at the organization level.
21+
22+
## SYNTAX
23+
24+
```powershell
25+
Get-PnPSearchResultType [-Identity <String>] [-Scope <SearchVerticalScope>] [-Verbose] [-Connection <PnPConnection>]
26+
```
27+
28+
## DESCRIPTION
29+
30+
This cmdlet retrieves the Microsoft Search result types configured for the site you are currently connected to, or at the organization (tenant) level when using `-Scope Organization`. Result types define how search results are displayed using Adaptive Card templates. They can be configured for SharePoint content or external connector content. It uses the Graph Connector Service (GCS) API at gcs.office.com.
31+
32+
> [!WARNING]
33+
> This cmdlet uses the Graph Connector Service (GCS) API, which is an internal Microsoft API that is not publicly documented or officially supported. It may change without notice.
34+
35+
### Prerequisites
36+
37+
Your Entra app registration must have the `ExternalConnection.ReadWrite.All` delegated permission from the Graph Connector Service (GCS) API. To add this permission using Azure CLI:
38+
39+
```bash
40+
az ad app permission add --id <your-app-id> --api 56c1da01-2129-48f7-9355-af6d59d42766 --api-permissions d44774bd-e26c-43b1-996d-51bb90a9078e=Scope
41+
az ad app permission admin-consent --id <your-app-id>
42+
```
43+
44+
> [!NOTE]
45+
> This cmdlet requires a **delegated (interactive)** connection. App-only (certificate-based) connections are not supported by the GCS API and will result in a 403 Forbidden error.
46+
47+
## EXAMPLES
48+
49+
### EXAMPLE 1
50+
```powershell
51+
Get-PnPSearchResultType
52+
```
53+
54+
Returns all search result types for the currently connected site.
55+
56+
### EXAMPLE 2
57+
```powershell
58+
Get-PnPSearchResultType -Identity "1770839639348_FYXB8XQI5"
59+
```
60+
61+
Returns the search result type with the specified logical ID.
62+
63+
### EXAMPLE 3
64+
```powershell
65+
Get-PnPSearchResultType -Identity "My Result Type"
66+
```
67+
68+
Returns the search result type with the specified name.
69+
70+
### EXAMPLE 4
71+
```powershell
72+
Get-PnPSearchResultType -Scope Organization
73+
```
74+
75+
Returns all organization-level search result types.
76+
77+
### EXAMPLE 5
78+
```powershell
79+
Get-PnPSearchResultType -Identity "1770839639348_FYXB8XQI5" | Select-Object -ExpandProperty Payload | Select-Object -ExpandProperty Rules
80+
```
81+
82+
Shows the rules configured for a specific result type.
83+
84+
### EXAMPLE 6
85+
```powershell
86+
Get-PnPSearchResultType | Where-Object { $_.Payload.IsActive -eq $false } | Remove-PnPSearchResultType
87+
```
88+
89+
Pipes inactive result types directly to `Remove-PnPSearchResultType`. The `LogicalId` property binds automatically to `-Identity`.
90+
91+
## PARAMETERS
92+
93+
### -Connection
94+
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing [Get-PnPConnection](Get-PnPConnection.md).
95+
96+
```yaml
97+
Type: PnPConnection
98+
Parameter Sets: (All)
99+
Required: False
100+
Position: Named
101+
Default value: None
102+
Accept pipeline input: False
103+
Accept wildcard characters: False
104+
```
105+
106+
### -Identity
107+
The logical ID or name of the search result type to retrieve. Logical IDs are in the format `{timestamp}_{randomId}`. If a name is provided, the cmdlet searches all result types for a matching name. If not provided, all result types will be returned.
108+
109+
```yaml
110+
Type: String
111+
Parameter Sets: (All)
112+
Required: False
113+
Position: 0
114+
Default value: None
115+
Accept pipeline input: True (ByValue, ByPropertyName)
116+
Accept wildcard characters: False
117+
Aliases: LogicalId
118+
```
119+
120+
### -Scope
121+
Specifies whether to retrieve site-level or organization-level result types. Defaults to Site.
122+
123+
```yaml
124+
Type: SearchVerticalScope
125+
Parameter Sets: (All)
126+
Accepted values: Site, Organization
127+
Required: False
128+
Position: Named
129+
Default value: Site
130+
Accept pipeline input: False
131+
Accept wildcard characters: False
132+
```
133+
134+
### -Verbose
135+
When provided, additional debug statements will be shown while executing the cmdlet.
136+
137+
```yaml
138+
Type: SwitchParameter
139+
Parameter Sets: (All)
140+
Required: False
141+
Position: Named
142+
Default value: None
143+
Accept pipeline input: False
144+
Accept wildcard characters: False
145+
```
146+
147+
## OUTPUT
148+
149+
Returns one or more `SearchResultType` objects with the following properties:
150+
151+
| Property | Type | Description |
152+
|----------|------|-------------|
153+
| Path | String | Site path in the format `:GUID:` |
154+
| LogicalId | String | Unique identifier (e.g. `1770839639348_FYXB8XQI5`) |
155+
| LastModifiedDateTime | String | Timestamp of last modification |
156+
| Payload | SearchResultTypePayload | The result type configuration (see below) |
157+
158+
The `Payload` object contains:
159+
160+
| Property | Type | Description |
161+
|----------|------|-------------|
162+
| Name | String | Display name of the result type |
163+
| IsActive | Boolean | Whether the result type is active |
164+
| Priority | Int | Priority order (1 = highest; lower numbers indicate higher priority) |
165+
| ContentSourceId | Object | Content source with `ContentSourceApplication`, `Identity`, `SystemId` |
166+
| ContentSourceName | String | Display name of the content source |
167+
| Rules | List | Matching rules (see below) |
168+
| DisplayTemplate | String | Adaptive Card JSON template |
169+
| DisplayProperties | List | Properties used in the display template |
170+
171+
Each rule in `Rules` contains:
172+
173+
| Property | JSON Key | Type | Description |
174+
|----------|----------|------|-------------|
175+
| PropertyName | PN | String | Property to match (e.g. "FileType", "IsListItem") |
176+
| Operator | PO | Object | Operator with `N` code and `JBO` flag |
177+
| Values | PV | List | Values to compare against |
178+
179+
Operator `N` codes: 1=Equals, 2=NotEquals, 3=Contains, 4=DoesNotContain, 5=LessThan, 6=GreaterThan, 7=StartsWith. Use [New-PnPSearchResultTypeRule](New-PnPSearchResultTypeRule.md) to create rules with friendly operator names.
180+
181+
## RELATED LINKS
182+
183+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPSearchSiteConnection.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: Get-PnPSearchSiteConnection
8+
---
9+
10+
# Get-PnPSearchSiteConnection
11+
12+
## SYNOPSIS
13+
14+
**Required Permissions**
15+
16+
* [Graph Connector Service (GCS) API](#prerequisites)
17+
* Site Administrator
18+
19+
Retrieves the external connector site connections available for the currently connected site.
20+
21+
## SYNTAX
22+
23+
```powershell
24+
Get-PnPSearchSiteConnection [-Identity <String>] [-Verbose] [-Connection <PnPConnection>]
25+
```
26+
27+
## DESCRIPTION
28+
29+
This cmdlet retrieves the external connector site connections configured for the site you are currently connected to. These connections represent external data sources (e.g., web crawlers, custom connectors) that can be used as content sources in search verticals. It uses the Graph Connector Service (GCS) API at gcs.office.com.
30+
31+
> [!WARNING]
32+
> This cmdlet uses the Graph Connector Service (GCS) API, which is an internal Microsoft API that is not publicly documented or officially supported. It may change without notice.
33+
34+
### Prerequisites
35+
36+
Your Entra app registration must have the `ExternalConnection.ReadWrite.All` delegated permission from the Graph Connector Service (GCS) API. To add this permission using Azure CLI:
37+
38+
```bash
39+
az ad app permission add --id <your-app-id> --api 56c1da01-2129-48f7-9355-af6d59d42766 --api-permissions d44774bd-e26c-43b1-996d-51bb90a9078e=Scope
40+
az ad app permission admin-consent --id <your-app-id>
41+
```
42+
43+
> [!NOTE]
44+
> This cmdlet requires a **delegated (interactive)** connection. App-only (certificate-based) connections are not supported by the GCS API and will result in a 403 Forbidden error.
45+
46+
## EXAMPLES
47+
48+
### EXAMPLE 1
49+
```powershell
50+
Get-PnPSearchSiteConnection
51+
```
52+
53+
Returns all external connector site connections available for the currently connected site.
54+
55+
### EXAMPLE 2
56+
```powershell
57+
Get-PnPSearchSiteConnection -Identity "techcrunch"
58+
```
59+
60+
Returns the site connection with the specified ID.
61+
62+
### EXAMPLE 3
63+
```powershell
64+
$connections = Get-PnPSearchSiteConnection
65+
$sources = $connections | ForEach-Object {
66+
[PnP.PowerShell.Commands.Model.Graph.MicrosoftSearch.SearchVerticalContentSource]@{ Id = $_.Id; Name = $_.Name }
67+
}
68+
New-PnPSearchVertical -DisplayName "External Content" -ContentSources $sources
69+
```
70+
71+
Retrieves all site connections and uses them as content sources when creating a new search vertical.
72+
73+
## PARAMETERS
74+
75+
### -Connection
76+
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing [Get-PnPConnection](Get-PnPConnection.md).
77+
78+
```yaml
79+
Type: PnPConnection
80+
Parameter Sets: (All)
81+
Required: False
82+
Position: Named
83+
Default value: None
84+
Accept pipeline input: False
85+
Accept wildcard characters: False
86+
```
87+
88+
### -Identity
89+
The ID of the site connection to retrieve. If not provided, all connections will be returned.
90+
91+
```yaml
92+
Type: String
93+
Parameter Sets: (All)
94+
Required: False
95+
Position: 0
96+
Default value: None
97+
Accept pipeline input: True (ByValue)
98+
Accept wildcard characters: False
99+
```
100+
101+
### -Verbose
102+
When provided, additional debug statements will be shown while executing the cmdlet.
103+
104+
```yaml
105+
Type: SwitchParameter
106+
Parameter Sets: (All)
107+
Required: False
108+
Position: Named
109+
Default value: None
110+
Accept pipeline input: False
111+
Accept wildcard characters: False
112+
```
113+
114+
## RELATED LINKS
115+
116+
[Get-PnPSearchExternalConnection](Get-PnPSearchExternalConnection.md) - Retrieves external connections at the tenant level via Microsoft Graph. Returns basic connection info (id, name, state) for all connections including those in draft state. Use `Get-PnPSearchSiteConnection` instead when you need detailed connection configuration (schema, crawl settings, identity configuration) or want to list only published connections available for search verticals.
117+
118+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

0 commit comments

Comments
 (0)