【问题标题】:How can I apply a SharePoint site template on an Azure PowerShell Runbook?如何在 Azure PowerShell Runbook 上应用 SharePoint 网站模板?
【发布时间】:2020-05-06 07:47:23
【问题描述】:

如何通过 PowerShell Azure Runbook 将 SharePoint 网站模板(保存为我的 One Drive 中的 XML 文件)应用到新创建的网站?

目前,在我的本地机器上,我使用Apply-PnPProvisioningTemplate -Path "path to XML file" -ClearNavigation

我不知道在哪里存储 XML 文件,或者如何使用 Runbook 访问它,谢谢

【问题讨论】:

  • 如果我没听错的话,你可以把xml文件放到azure blob storage。然后在runbook中,可以下载xml文件到本地runbook。
  • 谢谢@IvanYang,我会试试这个:)
  • 您好,如果下面的帖子对您​​有帮助,请您帮忙接受this link 的回答吗?谢谢。如果您对此仍有其他问题,请告诉我。
  • 嗨 @IvanYang,我仍在等待批准购买 blob 存储,但它看起来不错!如果在下面实施您的答案时有任何问题,我会告诉您:)
  • 你好,我想看看这个问题有没有更新?

标签: azure powershell sharepoint onedrive azure-runbook


【解决方案1】:

您可以将 xml 文件存储在 blob 存储中,然后在 azure runbook 中 -> 从 blob 存储中下载 xml 文件。

运行手册中的代码如下:

#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

【讨论】:

    猜你喜欢
    • 2018-09-25
    • 2016-12-31
    • 2012-08-15
    • 2022-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-05
    • 1970-01-01
    相关资源
    最近更新 更多