With an existing Cloud Service in Microsoft Azure there may be times where you want to take a backup of the current Service or to deploy a copy to another Azure subscription, but you do not have access to the original package used to create the Service. Luckily there is a way to retrieve the package using the Service Management REST API.
The call used to download the package is the Get Package endpoint. When called it will download the deployment package into the provided Azure storage container. This is called using a POST request, using this URL structure:
In this call we have 4 parameters that we need to include in the URL, they are subscription ID, the name of the cloudservice, the deployment name and the URI of the storage container.
The first 3 parameters can all be found on the dashboard tab of the Cloud Service. Subscription ID and the deployment name are both found in the quick glance section, while the deployment name is found at the top of the page.
The container URI can be found from the Containers tab of a Storage account, in the URL column. If there is no container for the account one must be created for the package to be downloaded into.
The Container URI is added to the end of the URL as a query string, with all the parameters inputted the URL now looks like this:
Also needed for this request are 2 request headers. These are: x-ms-version, with a version number of 2012-03-01 or higher, and ContentLength which must be set to 0.
For this example I am going to make this request using Fiddler, the URL and request headers are added as shown. When executed if this is successful a 202 response will be returned.