0

Would like to know if there is a way to enable RDP post Deployment. Post Build of a Cloud Service?

Options are available before packaging to do this!

Pradebban Raja
  • 443
  • 5
  • 20

1 Answers1

0

Found a working solution for this!

Set-AzureServiceRemoteDesktopExtension

You need the ServiceName to be passed to the snippet below.

        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 "
                }
            }
        }
Pradebban Raja
  • 443
  • 5
  • 20