[英]Installing azure module while running dsc configuration
In Azure I have created a new VM and using azure automation dsc I have uploaded my custom module. 在Azure中,我创建了一个新的VM,并使用Azure自动dsc上传了自定义模块。 In my custom module I am using New-AzureStorageContext. 在我的自定义模块中,我正在使用New-AzureStorageContext。 But when VM is connected to DSC Node I get the below error. 但是,当VM连接到DSC节点时,出现以下错误。
The term 'New-AzureStorageContext' is not recognized as the name of a cmdlet, function, script file, or operable program. 术语“ New-AzureStorageContext”不被视为cmdlet,函数,脚本文件或可运行程序的名称。 Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 检查名称的拼写,或者是否包含路径,请验证路径是否正确,然后重试。
When I go to C:\\Program Files\\WindowsPowerShell\\Modules folder in the new vm I do see my custom module imported but I do not see Azuer.Storage. 当我转到新虚拟机中的C:\\ Program Files \\ WindowsPowerShell \\ Modules文件夹时,我确实看到了导入的自定义模块,但没有看到Azuer.Storage。 I do see Azure.Storage as one of the default module in the Azure Automation Account. 我确实将Azure.Storage视为Azure自动化帐户中的默认模块之一。 What am I missing? 我想念什么?
Configuration Deploy
{
Import-DscResource -ModuleName cWebPackageDeploy
Import-DscResource -ModuleName Azure.Storage
node "localhost"
{
cWebPackageDeploy jswebpackage
{
Name = "website.zip"
StorageAccount = "testdeploy"
StorageKey = "xxxxxxxxxxxxxxxxxxxxxxx"
Ensure = "Present"
PackageVersion = "1.0"
DeployPath = "C:\Temp\Testdeploy"
}
}
}
Deploy
Went to the below link and added this dsc resource to my azure automation. 转到下面的链接,并将此dsc资源添加到我的azure自动化中。 Then I updated PSModuleResource Azure.Storage to my dsc script. 然后,我将PSModuleResource Azure.Storage更新为我的dsc脚本。
https://www.powershellgallery.com/packages/PowerShellModule/0.3 https://www.powershellgallery.com/packages/PowerShellModule/0.3
Configuration Deploy
{
Import-DscResource -ModuleName cWebPackageDeploy
Import-Dscresource -ModuleName PowerShellModule
node "localhost"
{
cWebPackageDeploy jswebpackage
{
Name = "website.zip"
StorageAccount = "testdeploy"
StorageKey = "xxxxxxxxxxxxxxxxxxxxxxx"
Ensure = "Present"
PackageVersion = "1.0"
DeployPath = "C:\Temp\Testdeploy"
DependsOn = "[PSModuleResource]Azure.Storage"
}
PSModuleResource Azure.Storage
{
Ensure = 'present'
Module_Name = 'Azure.Storage'
}
}
}
Deploy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.