Merge pull request #62 from coreysa/master
Added Static VNET IP and fixed a bug.
This commit is contained in:
Коммит
73b4f7a1c7
|
@ -229,14 +229,20 @@ FormatDisk
|
|||
|
||||
ConfigureDC
|
||||
|
||||
#Get the DIP
|
||||
$domainControllerIP = (get-azurevm -ServiceName $serviceName -Name $vmName).IpAddress
|
||||
# Get the DC IP
|
||||
$vm = Get-AzureVM -ServiceName $serviceName -Name $vmName
|
||||
$domainControllerIP = $vm.IpAddress
|
||||
|
||||
#Call UpdateVNetDNSEntry
|
||||
Write-Output "Configuring $vmName with a static internal IP, $domainControllerIP. This will allow stopping the VM later and still retain the IP."
|
||||
|
||||
# Set the IP as a static internal IP for the DC, to avoid losing it later.
|
||||
Set-AzureStaticVNETIP -IPAddress $domainControllerIP -VM $vm | Update-AzureVM
|
||||
|
||||
#Call UpdateVNetDNSEntry with the static internal IP.
|
||||
if(-not [String]::IsNullOrEmpty($domainControllerIP))
|
||||
{
|
||||
UpdateVNetDNSEntry $vmName $domainControllerIP
|
||||
}
|
||||
|
||||
|
||||
################## Script execution end ##############
|
||||
################## Script execution end ##############
|
||||
|
|
|
@ -48,7 +48,7 @@ $Password
|
|||
Select-AzureSubscription -SubscriptionName $SubscriptionName
|
||||
|
||||
#Get the hosted service WinRM Uri
|
||||
$uris = Get-AzureWinRMUri -ServiceName $ServiceName -Name $VM
|
||||
$uris = Get-AzureWinRMUri -ServiceName $serviceName -Name $vmName
|
||||
|
||||
$secPassword = ConvertTo-SecureString $Password -AsPlainText -Force
|
||||
$credential = New-Object System.Management.Automation.PSCredential($AdminUsername, $secPassword)
|
||||
|
@ -92,9 +92,9 @@ else
|
|||
if($user -eq $null)
|
||||
{
|
||||
# Create users
|
||||
New-ADUser –Name $ADUserName –SamAccountName $SamAccountName –DisplayName $DisplayName -Path $OuDn –Enabled $true –ChangePasswordAtLogon $false -AccountPassword (ConvertTo-SecureString $AccountPassword -AsPlainText -force) -PassThru -verbose
|
||||
New-ADUser -Name $ADUserName -SamAccountName $SamAccountName -DisplayName $DisplayName -Path $OuDn -Enabled $true -ChangePasswordAtLogon $false -AccountPassword (ConvertTo-SecureString $AccountPassword -AsPlainText -force) -PassThru -verbose
|
||||
}
|
||||
|
||||
} -ArgumentList $OuName, $ADUserName, $SamAccountName, $DisplayName, $AccountPassword
|
||||
|
||||
################## Script execution end #############
|
||||
################## Script execution end ##############
|
||||
|
|
Загрузка…
Ссылка в новой задаче