Hello all,
I’m experiencing with some DSC scripts in azure.
Login-AzureRmAccountShow-SubscriptionARM
$rgName = ‘rgName’
$storageAccountName = “storageaccount”$storageAccount = Get-AzureRmStorageAccount -ResourceGroupName $rgName -AccountName $storageAccountName
$storageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $rgName -AccountName $storageAccountName).Value[0]we are using default container
$containerName = ‘windows-powershell-dsc’
$configurationName = ‘IISInstall’
$configurationPath = “.$configurationName.ps1”
#Publish your DSC configuration to the Azure storage
$moduleURL = Publish-AzureRmVMDscConfiguration -ConfigurationPath $configurationPath -ResourceGroupName $rgName -StorageAccountName $storageAccount.StorageAccountName -Force$storageContext = New-AzureStorageContext -StorageAccountName $storageAccount.StorageAccountName -StorageAccountKey $storageAccountKey
$sasToken = New-AzureStorageContainerSASToken -Name $containerName -Context $storageContext -Permission r$settingsHashTable = @{
“ModulesUrl” = “$moduleURL”;
“ConfigurationFunction” = “$configurationName.ps1$configurationName”;
“SasToken” = “$sasToken”
}$vmName= “VMTEST”
$extensionName = ‘DSC’
$extensionType = ‘DSC’
$publisher = ‘Microsoft.Powershell’
$typeHandlerVersion = ‘2.1’Set-AzureRmVMExtension -ResourceGroupName $rgName -VMName $vmName -Location $storageAccount.Location `
-Name $extensionName -Publisher $publisher -ExtensionType $extensionType -TypeHandlerVersion $typeHandlerVersion `
-Settings $settingsHashTable
This script calls the DSC what is in these script:
Configuration IISInstall {Import-DSCResource -module xDSCDomainjoin #domain credentials to be given here $secdomainpasswd = ConvertTo-SecureString "password" -AsPlainText -Force $mydomaincreds = New-Object System.Management.Automation.PSCredential("domain\account", $secdomainpasswd) $domain = "mydomain" Node localhost
{
WindowsFeature IIS
{
Name = “Web-Server”
Ensure = “Present”
}# Install ASP.NET 4.5 WindowsFeature AspNet45 { Name = "Web-Asp-Net45" Ensure = "Present" } # Join domain xDSCDomainjoin JoinDomain { Domain = $domain Credential = $mydomaincreds } }
}
The first 2 steps are successful, however the domain join function always gives an error. Anyone knows what is the problem?
I would like to join the domain with the DSC script.