Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename-PnPTenantSite are not working as expected in Tenants with vanity url. #927

Closed
SouptakRoy opened this issue Oct 19, 2023 · 1 comment

Comments

@SouptakRoy
Copy link

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 pnp/powershell#137 and pnp/powershell#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

@SouptakRoy
Copy link
Author

SouptakRoy commented Oct 19, 2023

Submitted as PNP Powershell bug - pnp/powershell#3520 , closing this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant