The Azure Management API Cmdlets enable you to use PowerShell Cmdlets to manage your Azure projects.  You can access this project from the following link: 

Working with the Azure Management API Cmdlets

1. Follow the instructions to install the Cmdlets

2. Installing a certificate is needed for executing the Cmdlets:

For creating the certificate follow this instructions:

Viewing Certificates:

Lessons Learned

Install the certificate your are going to be using as the Azure Management API certificate in the computer you are using for Execution/development. If this is not done you will get errors like this one: Windows Azure PowerShell CMDLET returns "The HTTP request was forbidden with client authentication scheme 'Anonymous'" error message. Link:

Developing and Debugging Recommendations

1. Closing the PowerShell Windows for Compiling

The PowerShell shell windows will lock the build and rebuild of the project because it using the Azure Management Cmdlets compiled libraries. You need to close any PowerShell window you may have open before Building the Azure Cmdlets project and for un-installation of the Cmdlets.

2. Streamline Testing

Create a text file with the variables and values, open a PowerShell window and copy and paste the variables. The variables will be available for the entire life of the window.  Example:

$RolName = "WebRole1_IN_0"
$RolName2= "WebRole1_IN_1"
$Slot = "Production"
$ServiceName = "Mydemo"
$SubId = "6cad9315-45a8-3e4r4e-8bdc-3e3rfdeerrrf"
$Cert = "C:\certs\AzureManagementAPICertificate.cer"

Reboot-RoleInstance -RoleInstanceName $RolName -Slot $Slot -SubscriptionId $SubId -Certificate $Cert -ServiceName $ServiceName

ReImage-RoleInstance -RoleInstanceName $RolName2 -Slot $Slot -SubscriptionId $SubId -Certificate $Cert -ServiceName $ServiceName

Visual studio Azure Management Cmdlets debugging Steps: 

  1. Open the Azure Management Cmdlets Solution in Visual Studio
  2. Close all open PowerShell windows
  3. Open a CMD Windows and Run the Cmdlets Uninstall script:
    1. Find location “C:\AzureServiceManagementCmdlets\setup\dependency_checker\scripts\tasks”
    2. Run the script “uninstallPSSnapIn.bat”
  4. Recompile the project in Visual studio
  5. (as needed) Put your breakpoints
  6. On the CMD Window Run the Cmdlets installation script: installPSSnapIn.cmd
    1. Find location “C:\AzureServiceManagementCmdlets\setup\dependency_checker\scripts\tasks”
    2. Run the script “installPSSnapIn.cmd”
  7. Open a PowerShell Window. Run the following commands in the PowerShell window
    1. Add-PSSnapin AzureManagementToolsSnapIn
    2. Get-Command -PSSnapin AzureManagementToolsSnapIn
  8. Go back to Visual studio and  Attach the Debugger to the PowerShell
    1. Tools Tab –> Attach to Process… –> Attach to the PowerShelll process.
  9. Go back to the the PowerShell Window
    1. Setup the variables you may need:
        $RolName = "WebRole1_IN_0"
        $RolName2= "WebRole1_IN_1"
        $Slot = "Production"
        $ServiceName = "Mydemo"
        $SubId = "6cad9315-45a8-3e4r4e-8bdc-3e3rfdeerrrf"
        $Cert = "C:\certs\AzureManagementAPICertificate.cer
    2. Run the CmdLet you want to debug >> The execution will stop on the BreakPoint in Visual Studio
      1. For Example: Reboot-RoleInstance -RoleInstanceName $RolName -Slot $Slot -SubscriptionId $SubId -Certificate $Cert -ServiceName $ServiceName

Running the Commands:


Happy Development and Debugging! Thanks to David Aiken for the PowerShell tips and tricks.