Skip to content

Commit

Permalink
Adding support for vanity domains to several cmdlets (#3898)
Browse files Browse the repository at this point in the history
* Updating cmdlets to use the TenantAdminUrl if possible before trying to guess the tenant admin URL

* Adding PR reference
  • Loading branch information
KoenZomers authored Apr 18, 2024
1 parent b60f94e commit 4fb8aa7
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `Unlock-PnPSensitivityLabelEncryptedFile` which allows the encryption to be removed from a file [#3864](https://github.com/pnp/powershell/pull/3864)
- Added `Get-PnPLibraryFileVersionBatchDeleteJobStatus` and `Get-PnPSiteFileVersionBatchDeleteJobStatus` to check on the status of applying file based version expiration based on age on a library and site level [#3828](https://github.com/pnp/powershell/pull/3828)
- Added support for `Get-PnPSiteCollectionAppCatalog` and `Get-PnPTenantSite` to be used with vanity domain tenants [#3895](https://github.com/pnp/powershell/pull/3895)
- Added support for using vanity domain tenants with `Grant-PnPTenantServicePrincipalPermission`, `Revoke-PnPTenantServicePrincipalPermission`, `Set-PnPWebTheme`, `Invoke-PnPListDesign`, `Set-PnPSite`, `Add-PnPSiteDesignTask`, `Get-PnPSiteDesignRun`, `Get-PnPSiteDesignTask` and `Invoke-PnPSiteDesign` cmdlets [#3898](https://github.com/pnp/powershell/pull/3898)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Apps/GrantTenantServicePrincipalPermission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class GrantTenantServicePrincipalPermission : PnPGraphCmdlet
public string Resource = "Microsoft Graph";
protected override void ExecuteCmdlet()
{
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var spoWebAppServicePrincipal = new SPOWebAppServicePrincipal(tenantContext);
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/Apps/RevokeTenantServicePrincipalPermission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public class RevokeTenantServicePrincipal : PnPGraphCmdlet

protected override void ExecuteCmdlet()
{

var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var spoWebAppServicePrincipal = new SPOWebAppServicePrincipal(tenantContext);
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Branding/SetWebTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class SetWebTheme : PnPWebCmdlet
protected override void ExecuteCmdlet()
{
var url = CurrentWeb.EnsureProperty(w => w.Url);
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var tenant = new Tenant(tenantContext);
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ListDesign/InvokeListDesign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class InvokeListDesign : PnPWebCmdlet
protected override void ExecuteCmdlet()
{
var url = CurrentWeb.EnsureProperty(w => w.Url);
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var tenant = new Tenant(tenantContext);
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Site/SetSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected override void ExecuteCmdlet()

if (IsTenantProperty())
{
var tenantAdminUrl = UrlUtilities.GetTenantAdministrationUrl(context.Url);
var tenantAdminUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(context.Url);
context = context.Clone(tenantAdminUrl);

executeQueryRequired = false;
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/SiteDesigns/AddSiteDesignTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AddSiteDesignTask : PnPWebCmdlet
protected override void ExecuteCmdlet()
{
var url = CurrentWeb.EnsureProperty(w => w.Url);
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var webUrl = url;
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/SiteDesigns/GetSiteDesignRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GetSiteDesignRun : PnPWebCmdlet
protected override void ExecuteCmdlet()
{
var url = CurrentWeb.EnsureProperty(w => w.Url);
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var tenant = new Tenant(tenantContext);
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/SiteDesigns/GetSiteDesignTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GetSiteDesignTask : PnPWebCmdlet
protected override void ExecuteCmdlet()
{
var url = CurrentWeb.EnsureProperty(w => w.Url);
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
if (Identity != null)
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/SiteDesigns/InvokeSiteDesign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class InvokeSiteDesign : PnPWebCmdlet
protected override void ExecuteCmdlet()
{
var url = CurrentWeb.EnsureProperty(w => w.Url);
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
var tenantUrl = Connection.TenantAdminUrl ?? UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var tenant = new Tenant(tenantContext);
Expand Down

0 comments on commit 4fb8aa7

Please sign in to comment.