From 41e61a4b9e48889d3f03fbcd0120f9035f6b57b2 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 11 Mar 2023 01:11:40 +0100 Subject: [PATCH 1/2] Adding support for passing in a predefined tenant admin URL --- CHANGELOG.md | 1 + src/Commands/Apps/GrantAzureADAppSitePermission.cs | 3 +-- src/Commands/Search/SetSearchSettings.cs | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 879881219..9dd89f664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed issue with `Get-PnPListItem` cmdlet not respecting `RowLimit` in the CAML query. [#2804](https://github.com/pnp/powershell/pull/2804) - Fixed `Connect-PnPOnline -ManagedIdentity -UserAssignedManagedIdentityClientId` not working in Azure Automation Runbooks as it required usage of the object_id parameter instead of the principal_id to get an access token. [#2813](https://github.com/pnp/powershell/pull/2813) - Fixed `Register-PnPAzureADApp` cmdlet to not change or generate certificate if `-CertificatePath` parameter is already specified. [#2878](https://github.com/pnp/powershell/pull/2878) +- Fixed `Set-PnPSearchSettings` cmdlet not working with vanity domain tenants ### Contributors diff --git a/src/Commands/Apps/GrantAzureADAppSitePermission.cs b/src/Commands/Apps/GrantAzureADAppSitePermission.cs index 18811ea96..6ad1b0db4 100644 --- a/src/Commands/Apps/GrantAzureADAppSitePermission.cs +++ b/src/Commands/Apps/GrantAzureADAppSitePermission.cs @@ -32,7 +32,6 @@ public class GrantPnPAzureADAppSitePermission : PnPGraphCmdlet protected override void ExecuteCmdlet() { - Guid siteId = Guid.Empty; if (ParameterSpecified(nameof(Site))) { @@ -48,7 +47,7 @@ protected override void ExecuteCmdlet() var payload = new { roles = Permissions.Select(p => p.ToLower()).ToArray(), - grantedToIdentities = new[] { + grantedToIdentitiesV2 = new[] { new { application = new { id = AppId.ToString(), diff --git a/src/Commands/Search/SetSearchSettings.cs b/src/Commands/Search/SetSearchSettings.cs index 648f5f109..b91f3c767 100644 --- a/src/Commands/Search/SetSearchSettings.cs +++ b/src/Commands/Search/SetSearchSettings.cs @@ -1,7 +1,6 @@ using System; using System.Management.Automation; using Microsoft.SharePoint.Client; - using PnP.PowerShell.Commands.Enums; using Resources = PnP.PowerShell.Commands.Properties.Resources; @@ -81,11 +80,11 @@ protected override void ExecuteCmdlet() } if (hasSearchPageUrl) { - ClientContext.Web.SetSiteCollectionSearchCenterUrl(SearchPageUrl); + ClientContext.Web.SetSiteCollectionSearchCenterUrl(SearchPageUrl, Connection.TenantAdminUrl); } if (hasSearchPlaceholderText) { - ClientContext.Site.SetSearchBoxPlaceholderText(SearchBoxPlaceholderText); + ClientContext.Site.SetSearchBoxPlaceholderText(SearchBoxPlaceholderText, Connection.TenantAdminUrl); } if (SearchScope.HasValue && ClientContext.Site.RootWeb.SearchScope != SearchScope.Value) { @@ -102,11 +101,11 @@ protected override void ExecuteCmdlet() } if (hasSearchPageUrl) { - ClientContext.Web.SetWebSearchCenterUrl(SearchPageUrl); + ClientContext.Web.SetWebSearchCenterUrl(SearchPageUrl, Connection.TenantAdminUrl); } if (hasSearchPlaceholderText) { - ClientContext.Web.SetSearchBoxPlaceholderText(SearchBoxPlaceholderText); + ClientContext.Web.SetSearchBoxPlaceholderText(SearchBoxPlaceholderText, Connection.TenantAdminUrl); } if (SearchScope.HasValue && ClientContext.Web.SearchScope != SearchScope.Value) { From d682ca7b89dc5f1acd2490c12a18ddc96c4b2ea8 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Sat, 11 Mar 2023 01:22:01 +0100 Subject: [PATCH 2/2] Added PR reference --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd89f664..4b7591d8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,7 +90,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed issue with `Get-PnPListItem` cmdlet not respecting `RowLimit` in the CAML query. [#2804](https://github.com/pnp/powershell/pull/2804) - Fixed `Connect-PnPOnline -ManagedIdentity -UserAssignedManagedIdentityClientId` not working in Azure Automation Runbooks as it required usage of the object_id parameter instead of the principal_id to get an access token. [#2813](https://github.com/pnp/powershell/pull/2813) - Fixed `Register-PnPAzureADApp` cmdlet to not change or generate certificate if `-CertificatePath` parameter is already specified. [#2878](https://github.com/pnp/powershell/pull/2878) -- Fixed `Set-PnPSearchSettings` cmdlet not working with vanity domain tenants +- Fixed `Set-PnPSearchSettings` cmdlet not working with vanity domain tenants [#2884](https://github.com/pnp/powershell/pull/2884) ### Contributors