Skip to content

[BUG]Rename-PnPTenantSite are not working as expected in Tenants with vanity url. #3520

@SouptakRoy

Description

@SouptakRoy

Reporting an Issue or Missing Feature
Issue:
Rename-PnPTenantSite are not working as expected in Tenants with vanity url.
Site URL – https://contoso-xyz.sharepoint.com/
Admin URL - https://contosoadmin-xyz.sharepoint.com/
The error message shows wrong tenant url if we connect to Site URL only. If we connect using Tenant Admin URL it shows below error –
Rename-PnPTenantSite : An error occurred while sending the request.
Expected behavior
Expected behavior is to Rename SPO Site URL without any error.
Actual behavior
If we connect using SPO Site URL only, we get wrong tenant error as it tries to form Tenant Admin url dynamically and goes to wrong url. Same like #137 and #2567

Connect-PnPOnline -Url "https://contoso-xyz.sharepoint.com/sites/Test" -Interactive

Rename-PnPTenantSite : Unable to connect to the SharePoint Online Admin Center at ‘https://contoso-xyz-admin.sharepoint.com/' to run this cmdlet. Please ensure you pass in the
correct Admin Center URL using Connect-PnPOnline -TenantAdminUrl and you have access to it. Error message: AADSTS500011: The resource principal named
https://contoso-xyz-admin.sharepoint.com/' was not found in the tenant named XYZ. This can happen if the application has not been installed by the administrator of the tenant or
consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.

Timestamp: 2023-10-18 21:37:26Z.
At line:1 char:1

Rename-PnPTenantSite -Identity $currentSiteUrl -NewSiteUrl $updatedSi ...

  • CategoryInfo : InvalidOperation: (:) [Rename-PnPTenantSite], PSInvalidOperationException
  • FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Admin.RenameTenantSite

If we try to connect with Tenant Admin url, it shows “An error occurred while sending the request.”

Connect-PnPOnline -TenantAdminUrl "https://contosoadmin-xyz.sharepoint.com” -Url "https://contoso-xyz.sharepoint.com/sites/Test" -Interactive
Rename-PnPTenantSite -Identity $currentSiteUrl -NewSiteUrl $updatedSiteUrl

Rename-PnPTenantSite : An error occurred while sending the request.
At line:1 char:1

Rename-PnPTenantSite -Identity $currentSiteUrl -NewSiteUrl $updatedSi ...

  • CategoryInfo : WriteError: (:) [Rename-PnPTenantSite], HttpRequestException
  • FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Admin.RenameTenantSite
    Steps to reproduce behavior
    Connect-PnPOnline -TenantAdminUrl "https://contosoadmin-xyz.sharepoint.com” -Url "https://contoso-xyz.sharepoint.com/sites/Test" -Interactive
    Rename-PnPTenantSite -Identity $currentSiteUrl -NewSiteUrl $updatedSiteUrl
    What is the version of the Cmdlet module you are running?
    ModuleType Version Name ExportedCommands

Manifest 1.12.0 PnP.PowerShell {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagValue, Add-PnPSiteClassification, Copy-PnPFolder...}
Which operating system/environment are you running PnP PowerShell on?
• [ x] Windows
• Linux
• MacOS
• Azure Cloud Shell
• Azure Functions
• Other : please specify

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmore info neededFurther information is requested by user

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions