0
我试过下面的例子从Azure blob或Azure文件共享下载,但从来没有得到它的工作。有没有办法将文件下载到VM传递证书或密钥?Powershell DSC - 下载MSI文件到VM
Import-DSCResource -ModuleName PSDesiredStateConfiguration, xPSDesiredStateConfiguration
Node webServer
{ xRemoteFile Installs
{
DestinationPath = "C:\Scripts"
Credential = $StorageCredential
Ensure = "Present"
SourcePath = "https://storagename.blob.core.windows.net/installs"
Type = "Directory"
Recurse = $true
}
}
我也尝试过使用File模块。
Import-DSCResource -ModuleName PSDesiredStateConfiguration, xPSDesiredStateConfiguration
Node webServer
{
File Installs
{
DestinationPath = "C:\Scripts"
Credential = $StorageCredential
Ensure = "Present"
SourcePath = "\\storagename.file.core.windows.net\installs"
Type = "Directory"
Recurse = $true
}
}
我正在使用ARM VM,能否提供使用Set-Azure Rm VM Dsc扩展的示例? – DXH
嗨,你试试这个'设置AzureRmVMDscExtension -Version 2.21 -ResourceGroupName $资源组-VMName $ VMNAME -ArchiveBlobName “Sample.ps1.zip” -ArchiveStorageAccountName “STG” -ConfigurationName MyConfiguration -ConfigurationArgument @ {storageCredential =(GET-凭据) }'? –
此外,我建议你可以使用自定义脚本扩展将文件下载到你的虚拟机,然后使用DSC来安装它们。 –