想知道是否有办法在部署后启用 RDP。云服务的后期构建?
包装前有选项可以做到这一点!
想知道是否有办法在部署后启用 RDP。云服务的后期构建?
包装前有选项可以做到这一点!
找到了一个可行的解决方案!
设置 AzureServiceRemoteDesktopExtension
您需要将 ServiceName 传递给下面的代码段。
if(($UserName) -and ($Password))
{
$SecurePass = ConvertTo-SecureString -string $Password -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential $UserName, $SecurePass
# Check if RDP is enabled for the Service
$isRDPEnaled = Get-AzureServiceRemoteDesktopExtension -ServiceName $ServiceName
if(!$isRDPEnaled)
{
# Enable RDP with the new user
Set-AzureServiceRemoteDesktopExtension -ServiceName $ServiceName -Credential $Credential
}
else
{
if($isRDPEnaled.UserName -ne $UserName)
{
# Remove RDP for the existing user
Remove-AzureServiceRemoteDesktopExtension -ServiceName $ServiceName
# Enable RDP with the new user
Set-AzureServiceRemoteDesktopExtension -ServiceName $ServiceName -Credential $Credential
}
else
{
Write-Verbose ""
Write-Verbose " Remote Login enabled for the Service "
}
}
}