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來安裝它們。 –