[BUG] Runbook automation unable to continue after creating TeamsSite using new-pnpsite

Abierto
#5,485 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp, powershell
Área
backend

Línea de trabajo

Start by locating the New-PnPSite implementation and its tests, then trace how the -Wait option behaves when run under Azure Automation with a managed-identity connection. The report says the site and group are created but execution never resumes, even with -Wait omitted; reproduce that behavior and verify the runbook continues after the command returns.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
Reporting an Issue or Missing Feature

I have a Azure Automation resource with permissions set to Sites.FullControl.All, Group.Create Group.ReadWrite.All, the runbook connects through Powershell to the admin site, and then the new-pnpsite is called:

New-PnPSite -Type TeamSite -Title $SiteName -Alias $groupAlias -SiteAlias $groupAlias -TimeZone 4 -Lcid 1033 -Owners $owners -Connection $adminConnection -Wait -ErrorAction Stop -Verbose

The script now just stops executing and remains in the 'running' state. I have to stop the script manually. I have attached verbose logging.

In the background the Teamssite is actually created, the Teams group gets created and I am able to connect-pnpsite with another runbook. setting the Wait to $false and polling the site being created doesn't help either, the script just remains in a indefinite waiting state after calling New-PnPSite.

Expected behavior

I expected the script to continue running, now the logging just cuts off at New-PnPSite and nothing else is logged.

Actual behavior

The site is created, but the script is stuck.

Steps to reproduce behavior

Create Azure Automation account, provide Sites.FullControl.All and Group.ReadWrite.All permissions.

$adminConnection = Connect-PnPOnline -Url $spoAdminSiteUrl -ManagedIdentity -ReturnConnection -ErrorAction Stop

New-PnPSite -Type TeamSite -Title $SiteName -Alias $groupAlias -SiteAlias $groupAlias -TimeZone 4 -Lcid 1033 -Owners $owners -Connection $adminConnection -Wait -ErrorAction Stop -Verbose
Tail of Verbose logging:
10/5/2026, 15:52:54 - Verbose: Cmdlet execution done for $adminConnection = Connect-PnPOnline -Url $spoAdminSiteUrl -ManagedIdentity -ReturnConnection -ErrorAction Stop

10/5/2026, 15:52:54 - Verbose: Cmdlet execution started for 	$existingGroup = Get-PnPMicrosoft365Group -Identity $groupAlias -Connection $adminConnection -ErrorAction SilentlyContinue

10/5/2026, 15:52:55 - Verbose: Cmdlet execution done for 	$existingGroup = Get-PnPMicrosoft365Group -Identity $groupAlias -Connection $adminConnection -ErrorAction SilentlyContinue

10/5/2026, 15:52:55 - Verbose: Cmdlet execution started for 	$existingSite = Get-PnPTenantSite -Identity $spoSiteUrl -Connection $adminConnection -ErrorAction SilentlyContinue

10/5/2026, 15:52:55 - Verbose: Already connect to the SharePoint Online Admin Center at 'https://REDACTED-admin.sharepoint.com'
10/5/2026, 15:52:56 - Verbose: Cmdlet execution done for 	$existingSite = Get-PnPTenantSite -Identity $spoSiteUrl -Connection $adminConnection -ErrorAction SilentlyContinue

10/5/2026, 15:52:56 - Output: Creating group-connected SharePoint site 'https://REDACTED.sharepoint.com/sites/prj-2026-test-stefan-200'.
10/5/2026, 15:52:56 - Verbose: Cmdlet execution started for 	New-PnPSite -Type TeamSite -Title $SiteName -Alias $groupAlias -SiteAlias $groupAlias -TimeZone 4 -Lcid 1033 -Owners $owners -Connection $adminConnection -Wait -ErrorAction Stop -Verbose

There is no further logging.

What is the version of the Cmdlet module you are running?

3.4.1

Which operating system/environment are you running PnP PowerShell on?
  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : Azure Automation Powershell Runbook
Lenguaje dominante
C#
Estrellas
912
Forks
407
Merge medio
23 h 19 min
PR fusionados (30 d)
9

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pnp/powershell

Todos los issues de pnp/powershell

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.