I need to write a powershell workflow that creates an Azure Virtual Machine and executes some azure cmdlets in that Azure Virtual Machine. But the newly created VM has no azure powershell module installed in it. My code would be like this
    New-AzureQuickVM -Windows -ServiceName $serviceName -Name $vmname -ImageName $VMImage  -Password $password -AdminUserName $username -InstanceSize "ExtraSmall" -WaitForBoot
    $WinRmUri = Get-AzureWinRMUri -ServiceName $serviceName -Name $vmname
    $Cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
    Invoke-Command -ConnectionUri $WinRmUri -Credential $Cred -ScriptBlock {
         Add-AzureAccount ......  ## These cmdlets need Azure Powershell Module 
         Set-AzureSubscription........
         New-AzureStorageAccount......
    }
I am not supposed to manually get rdp of that VM and open it to install Azure Powershell Module but to dynamically create a VM using powershell cmdlet and install azure module in that vm using powershell itself.
                        
You may use Azure Automation service implementing your Powershell code into a runbook.
http://azure.microsoft.com/en-us/documentation/services/automation/