azure - 如何在 Azure PowerShell Runbook 上应用 SharePoint 网站模板?
问题描述
如何通过 PowerShell Azure Runbook 将 SharePoint 网站模板(保存为我的 One Drive 中的 XML 文件)应用到新创建的网站?
目前,在我的本地机器上,我使用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
推荐阅读
- sql - 如何在红移中获取过去 X 周的数据?
- javascript - 将水平线添加到 AmCharts4 哑铃图
- microsoft-graph-api - MS Graph API 仅在某些 IP 上返回混合集成错误
- ruby-on-rails - 多态性和 jsonapi-resources 错误
- c++ - 如何在 VTK 中显示图像数组
- python - 如何从网络摄像头捕获视频并将其提供给我在网络应用程序(浏览器内)内的 Yolov5 训练模型(在 PyTorch 中)?
- java - 如何使用 xsd 模式定义避免重复类型?
- centos7 - 为 centos 复制 netplan 名称服务器配置
- javascript - 将响应数据传递给数组
- java - 如何在 SharedPreferences 中永久保存数据