Invoke-PnPTenantTemplate runs into timeout error when authentication via ClientId and Certificate
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Issue
While calling Invoke-PnPTenantTemplate, my provisioning routine always runs into a timeout error.
I'm trying to create a new Team via a tenant template in App-only context (AuthN via self registered Azure AD and certificate). After a few minutes, the provisioning process get stuck and always fails with the following three errors:

[1]: Teamifying site at URL - https://{myTenant}.sharepoint.com/sites/TEST-6ff9e109-74b9-4f2f-b5ae-86b0262a93a5 failed due to an exception:- Exception while invoking endpoint https://graph.microsoft.com/v1.0/groups/d0a167e1-8f5f-47b4-8641-90f49117bcb7/team.
This is a common error – so nothing special to me.
[2]: Teamifying prompt couldn't be hidden at site at URL - https://{myTenant}.sharepoint.com/sites/TEST-6ff9e109-74b9-4f2f-b5ae-86b0262a93a5 in App-only context
[3]: Team with id d0a167e1-8f5f-47b4-8641-90f49117bcb7 not created within timeout.
This error occurs after a while
The whole provisioning process runs like a charm while authenticating as user (with user credential).
Process
I'm trying to connect and provision this way:
try {
$connAdmin = Connect-PnPOnline -Url "https://{myTenant}-admin.sharepoint.com/" -ClientId $clientId -Tenant $tenant -CertificateBase64Encoded $secret -ReturnConnection
$newSiteCollection = Invoke-PnPTenantTemplate -Template $provisioningTemplate -Parameters $pnpParameters -Connection $connAdmin -Verbose -ErrorAction $ErrorActionPreference
} catch {
Write-Warning "Error while connecting or invoking template"
throw $PSItem
}
Any clue, @PaoloPia? Would you help me investigate why the provisioning process always get stuck and fails with a timeout?
Thanks a lot and many greetings, Tobias
version of the PnP module
PnP.Powershell 1.9.0 (PowerShell 5.1)
operating system / environment running PnP PowerShell
- Windows
- Linux
- MacOS
- Azure Cloud Shell
- Azure Functions
- Azure Automation
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Connect-PnPOnline and Invoke-PnPTenantTemplate calls in the reported Azure Automation setup, comparing certificate-based app-only authentication with the working user-authenticated process. Reproduce the tenant-template run and inspect the Microsoft Graph team endpoint and timeout errors. Done means the template creates the Team and completes without the app-only timeout or related failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- authentication, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100