Azure上。如何部署DSC引用的自定义文件

时间:2017-03-10 19:22:59

标签: azure dsc

我正在构建一个Azure RM模板,它将在目标VM上安装DSC。 DSC必须使用.bacpac文件。如何将该文件上载到目标VM?如何让目标VM从GitHub下载并放置在特定文件夹中? DSC配置如下所示: https://github.com/PowerShell/xDatabase/blob/dev/Examples/Sample_xDatabase.ps1

1 个答案:

答案 0 :(得分:2)

这样的事情:

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"
    }
}