简体   繁体   English

Azure自动化DSC-权限和模块问题

[英]Azure Automation DSC - Permission and Module Issues

Are there any Azure Automation DSC gurus who can help with some guidance and know-how for pushing through a couple impasses I am currently encountering? 是否有任何Azure自动化DSC专家可以提供一些指导和专业知识,以帮助解决我目前遇到的一些难题?

The task at hand is: Use Azure Automation Runbook to provision a VM. 当前的任务是:使用Azure Automation Runbook设置VM。 That VM should immediately be associated with a DSC configuration, which will adjust Windows features, settings, and install SQL Server according to a specific configuration. 该VM应该立即与DSC配置相关联,该DSC配置将调整Windows功能,设置并根据特定配置安装SQL Server。 All tasks conducted need to be written in PowerShell and should require no manual input via Azure portal at any point. 所执行的所有任务都需要用PowerShell编写,并且在任何时候都不需要通过Azure门户进行手动输入。

At this time, the Runbook provisioning the VM is working perfectly. 此时,配置VM的Runbook运行良好。 However, associating this new node with a DSC configuration is still a manual process, which also is working (with the exception of the next issue mentioned below). 但是,将这个新节点与DSC配置相关联仍然是一个手动过程,该过程也正在起作用(除了下面提到的下一个问题)。 However, this process needs to be automated instead. 但是,此过程需要自动化。 How is this done? 怎么做? Via DSC resources as children of the VM resource in the ARM template? 通过DSC资源作为ARM模板中VM资源的子级吗?

Getting SQL Server installed is the next step. 下一步是安装SQL Server。 The xSQLServer DSC module seemed perfect for achieving this, but it currently has a bug in Azure Automation , which means that the xSQLServerSetup resource is not available, even when using older versions of xSQLServer. xSQLServer DSC模块似乎非常适合实现此目的,但是它目前在Azure自动化中存在一个错误 ,这意味着即使使用旧版本的xSQLServer,xSQLServerSetup资源也不可用。 So, there appear to be two possible workarounds to this… 因此,似乎有两种可能的解决方法……

Workaround 1: Not use xSQLServer and just run a PS script that is local on the newly provisioned VM to install SQL Server using a command line installation using an INI file. 解决方法1:不使用xSQLServer,而只运行新配置的VM上本地的PS脚本,以使用INI文件通过命令行安装来安装SQL Server。 The PS script to install SQL works, but only when run manually. 用于安装SQL的PS脚本有效,但仅在手动运行时有效。 When attempting to have DSC run this script, Azure is throwing an error that the script is not digitally signed. 尝试让DSC运行此脚本时,Azure引发错误,该脚本未进行数字签名。 So, there appears to be a permissions scoping issue at play, and the DSC credential is not able to run the local PS script even though the local admin credential is being passed in. How does one get around this? 因此,似乎存在权限范围问题,并且即使传入了本地管理员凭据,DSC凭据也无法运行本地PS脚本。如何解决这个问题?

Workaround 2: Apparently, it is supposed to be possible to provision a VM, compile the DSC MOF local on that machine (with the full version of xSQLServer), and then push that registration back to Azure Automation. 解决方法2:显然,应该可以配置VM,在该计算机上编译本地DSC MOF(具有完整版本的xSQLServer),然后将该注册推回Azure自动化。 Though, it is unclear how exactly this would be done, as it appears to also require the execution of a local PS script, thus providing the same impasse as the first workaround. 但是,目前尚不清楚如何完成此操作,因为它似乎还需要执行本地PS脚本,因此与第一个解决方法具有相同的僵局。 Is this perhaps via a Custom Script extension in the ARM template, or…? 这可能是通过ARM模板中的自定义脚本扩展实现的,还是…?

I can see all of the parts in play, and I've found several helpful resources online that give breadcrumbs to the solution. 我可以看到所有正在运行的部分,并且我在网上找到了一些有用的资源,这些资源为解决方案提供了面包屑。 But, the breadcrumbs are too far apart, and the proper way of wiring everything together is proving to be elusive. 但是,面包屑相距太远,事实证明将所有事物连接在一起的正确方法难以捉摸。 So, I'm here humbly asking for help and guidance in getting this worked out. 因此,我在这里谦虚地寻求帮助和指导以解决这个问题。

Any help would be greatly appreciated. 任何帮助将不胜感激。

Thanks! 谢谢!

First of all that's a lot of questions instead of 1. 首先是很多问题,而不是1。

  1. unless this is some kind of homework - there is no point in installing sql on a vm, there are a lot of vm + sql images in Azure and it would take 5 minutes instead of 60 to provision such a vm. 除非这是某种家庭作业-在vm上安装sql毫无意义,否则Azure中会有很多vm + sql映像,并且配置这样的vm需要5分钟而不是60分钟。
  2. When attempting to have DSC run this script, Azure is throwing an error that the script is not digitally signed. - this means your script is not signed (not related to rights\\permissions), look for execution policy , you need to set it to unrestricted before running your script (but you don't need to, because of the first point). -这意味着您的脚本未签名(与权利\\权限无关),查找execution policy ,您需要在运行脚本之前将其设置为不受限制(但由于第一点,您不需要这样做)。
  3. you compile mof or upload it and then you can "tie" a vm to that mof, it can be automated with powershell (both parts), there are a lot of guides on how to do that. 您可以编译Mof或将其上传,然后可以将VM“绑定”到该Mof,可以使用powershell(包括两个部分)将其自动化,有关如何执行此操作的指南很多。 Like this 这样

As a general rule, use arm template to do the whole thing, again, there are lots of examples on how to achieve that (just browse this repo). 作为一般规则,请使用arm模板来完成整个操作,此外,还有很多有关如何实现目的的示例(只需浏览此存储库)。 Provisioning infrastructure with powershell (on azure) is not the best way of doing things. 使用Powershell(天蓝色)配置基础架构并不是最佳的处理方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM