Forum Discussion
Error:Microsoft.SharePoint.Client.ServerException: Argument SiteUrl must be a tenant administration
Hello- I ma using PNP site provisioning engine to create sites. But while running the batch and at the time of creation of site it is giving error:
"Microsoft.SharePoint.Client.ServerException: Argument SiteUrl must be a tenant administration site."
While I have used Poershell to make the site collection as tenant administration site. Also the apps are having Full Control permission in the site.
Any help will be much appreaciated.
- paulpaschaBronze Contributor
Did you connect / authenticate to the SharePoint Admin Center site (https://[tenantname]-admin.sharepoint.com before executing your PowerShell script? Typically, before executing your PowerShell script to create sites (site collections), you'd first have to connect to SharePoint Online using one of the Connect-SPOService / Connect-SPOnline / Connect-PnPOnline PowerShell commands and specify your SharePoint Admin Center site with a least SharePoint Administrator credentials
- Sayan DuttaMajumdarCopper Contributor
I am creating a batch file for on Premises SP 2013.
- Deleted
Sayan DuttaMajumdar can you post your powershell?
- Sayan DuttaMajumdarCopper Contributor
Hi- I have run below 2 Powershell command:
Script1:
cls
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$url ="https://SSSSSSSSSSSSSSSSSSSSSS"Write-Host "Setting $url as tenant site ..." -ForegroundColor Yellow
$site = get-spsite -Identity $url
$site.AdministrationSiteType = [Microsoft.SharePoint.SPAdministrationSiteType]::TenantAdministration
Write-Host "$url set as tenant site!" -ForegroundColor GreenScript2:
Set-SPSiteAdministration "https:/sssssss" -AdministrationSiteType TenantAdministration
IISRESET
This script isn't using the PnP PowerrShell options available.
Please look here: https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/readme.md
You are looking for the New-PnPTenantSite Cmdlet.
https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/NewPnPTenantSite.md