如何在 Azure PowerShell Runbook 上应用 SharePoint 网站模板?
How can I apply a SharePoint site template on an Azure PowerShell Runbook?
如何通过 PowerShell Azure Runbook 将保存为 XML 文件的 SharePoint 网站模板应用到新创建的网站?
目前,在我的本地机器上,我使用 Apply-PnPProvisioningTemplate -Path "path to XML file" -ClearNavigation
我不知道在哪里存储 XML 文件,或者如何使用 Runbook 访问它,谢谢
您可以将 xml 文件存储在 blob 存储中,然后在 azure runbook 中 -> 从 blob 存储中下载 xml 文件。
Runbook 中的代码如下:
#download xml file from blob storage
$account_name = "blob_storage_account_name"
$account_key = "blob_storage_account_key"
$context = New-AzStorageContext -StorageAccountName $account_name -StorageAccountKey $account_key
$xml_name_local="your_xml_name_when_download_to_local"
$blob_name = "your_xml"
$container_name = "container_stored_xml_file"
Get-AzStorageBlobContent -Blob $blob_name -Container $container_name -Destination "$Env:temp$xml_name_local" -Context $context
#then you can use "$Env:temp$xml_name_local" to replace "path to XML file"
Apply-PnPProvisioningTemplate -Path "path to XML file" -ClearNavigation
如何通过 PowerShell Azure Runbook 将保存为 XML 文件的 SharePoint 网站模板应用到新创建的网站?
目前,在我的本地机器上,我使用 Apply-PnPProvisioningTemplate -Path "path to XML file" -ClearNavigation
我不知道在哪里存储 XML 文件,或者如何使用 Runbook 访问它,谢谢
您可以将 xml 文件存储在 blob 存储中,然后在 azure runbook 中 -> 从 blob 存储中下载 xml 文件。
Runbook 中的代码如下:
#download xml file from blob storage
$account_name = "blob_storage_account_name"
$account_key = "blob_storage_account_key"
$context = New-AzStorageContext -StorageAccountName $account_name -StorageAccountKey $account_key
$xml_name_local="your_xml_name_when_download_to_local"
$blob_name = "your_xml"
$container_name = "container_stored_xml_file"
Get-AzStorageBlobContent -Blob $blob_name -Container $container_name -Destination "$Env:temp$xml_name_local" -Context $context
#then you can use "$Env:temp$xml_name_local" to replace "path to XML file"
Apply-PnPProvisioningTemplate -Path "path to XML file" -ClearNavigation