ARM模板+DSC部署4台SharePoint虚拟机:PowerShell模块复制失败
From your logs and error details, the core issue here is a misconfigured ZIP package structure for your SharePoint DSC configuration, which makes the Azure DSC extension misinterpret your script as a module instead of loading it correctly. Let’s break this down and fix it:
Why the AD Join DSC Works but SharePoint Doesn't
Looking at your successful AD join logs, that ZIP package contains valid PowerShell DSC resource modules: folders like xActiveDirectory and xComputerManagement, each with their own module manifest (.psd1) files. The DSC extension recognizes these as proper modules, copies them to C:\Program Files\WindowsPowerShell\Modules, then executes the configuration script correctly.
For your SharePoint configuration, however, your ZIP package has the SharePointConfiguration.ps1 script directly at the root. The DSC extension tries to treat this single script as a module:
- It creates a folder named
SharePointConfiguration.ps1in the Modules directory - Copies the script into that folder
- When it tries to execute the script, it’s looking for a module/function with that full path name, which doesn’t exist—hence the "not recognized" error.
Step-by-Step Fixes
1. Restructure Your SharePoint DSC ZIP Package
You need to package your script in a valid PowerShell module structure:
- Create a new folder named
SharePointConfiguration(match the script name, without the.ps1extension) - Move your
SharePointConfiguration.ps1script into this folder - Generate a module manifest file (
.psd1) inside the folder to tell PowerShell this is a valid module:New-ModuleManifest -Path .\SharePointConfiguration\SharePointConfiguration.psd1 ` -RootModule "SharePointConfiguration.ps1" ` -Author "Your Name" ` -Description "DSC Configuration for SharePoint Farm Setup" - Zip the entire
SharePointConfigurationfolder (not just the files inside)—the root of the ZIP should be this folder, not the individual script.
2. Update Your DSC Extension Parameters
Ensure your spConfigurationFunction parameter points to the correct configuration function in your script, using the format:SharePointConfiguration\YourConfigurationFunctionName
For example, if your script defines a configuration called ConfigureSharePointFarm, the value would be SharePointConfiguration\ConfigureSharePointFarm.
3. Re-Upload and Redeploy
- Replace the old
SharePointConfiguration.ps1.zipin your Azure Blob container with your newly structured ZIP file - Clean up any failed deployments in Azure, then re-run your ARM template deployment.
Additional Checks
- Verify your Blob container has the correct permissions (if it’s private, ensure your ARM template uses a valid SAS token to access the ZIP)
- Consider upgrading the DSC extension version (you’re using 2.80.0.0; newer versions have better error handling and compatibility)
内容的提问来源于stack exchange,提问作者Enzo Derozereuil

