天蓝色。如何部署 DSC 引用的自定义文件
Azure. How to deploy custom file referenced by DSC
我正在构建一个 Azure RM 模板,它将在目标 VM 上安装 DSC。 DSC 必须使用 .bacpac 文件。如何将该文件上传到目标 VM?如何让目标 VM 从 GitHub 下载它并将其放置在特定文件夹中?
DSC 配置如下所示:
https://github.com/PowerShell/xDatabase/blob/dev/Examples/Sample_xDatabase.ps1
像这样:
Import-DscResource -ModuleName PSDesiredStateConfiguration,xPSDesiredStateConfiguration,xDatabase
Node $nodeName
{
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
}
xRemoteFile BacPacPackage
{
Uri = "https://github.com/url_to_your_bacpac"
DestinationPath = "c:\where_to_put_it"
MatchSource = $false
}
xDatabase DeployBacPac
{
Ensure = "Present"
SqlServer = $nodeName
SqlServerVersion = $SqlServerVersion
DatabaseName = $DatabaseName
Credentials = $credential # credentials to access SQL
BacPacPath = "c:\path_from_previous command"
DependsOn = "[xRemoteFile]BacPacPackage"
}
}
我正在构建一个 Azure RM 模板,它将在目标 VM 上安装 DSC。 DSC 必须使用 .bacpac 文件。如何将该文件上传到目标 VM?如何让目标 VM 从 GitHub 下载它并将其放置在特定文件夹中? DSC 配置如下所示: https://github.com/PowerShell/xDatabase/blob/dev/Examples/Sample_xDatabase.ps1
像这样:
Import-DscResource -ModuleName PSDesiredStateConfiguration,xPSDesiredStateConfiguration,xDatabase
Node $nodeName
{
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
}
xRemoteFile BacPacPackage
{
Uri = "https://github.com/url_to_your_bacpac"
DestinationPath = "c:\where_to_put_it"
MatchSource = $false
}
xDatabase DeployBacPac
{
Ensure = "Present"
SqlServer = $nodeName
SqlServerVersion = $SqlServerVersion
DatabaseName = $DatabaseName
Credentials = $credential # credentials to access SQL
BacPacPath = "c:\path_from_previous command"
DependsOn = "[xRemoteFile]BacPacPackage"
}
}