Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Azure

Running a healthy service in the cloud : Using the service management API (part 2) - Listing your services and containers

3/23/2011 6:10:13 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

3. Listing your services and containers

You can save a lot of time if you learn how to automate your deployments instead of doing them by hand through the portal. We’re going to start this section by showing some code you can use to get a list of the service and storage accounts you’ve created in Azure. This code is fairly primitive and uses the REST API directly. We’ll eventually start using a tool that will abstract away the raw REST so that you have something nicer to work with.

You’re going to use the WebRequest class to work with the REST call you’ll be making. You need to pass in the URI of the call you want to make. The following listing shows how to use REST to query for a list of services.

Listing 1. Querying for the list of services with REST

In the previous listing, you pass in a string that includes the root of the call, https://management.core.windows.net/, and the subscription ID (which can be found on your Accounts tab in the portal) at . You pass this string because you want a list of the services that you’ve created. Every request into the management service needs this base address. Because for this example we want to include a list of the hosted services you have in your account, add /services/hostedservices to the end of your URL.

You also need to attach a version header and your certificate for authentication. The version header tells Azure which version of the management service you intend to call. Right now the latest version to call is the one that was published in October of 2009, so let’s use that one. The certificate is easily attached at line . You’re attaching it from the file you generated above. You could have used the certificate that’s in your secure certificate store.

When you run this code, the result you get in raw XML format is shown in the following listing. All three services that are running in your subscription (aiademo1, aiademo2, and aiademo3) are listed in HostedService elements.

Listing 2. The raw XML that comes back from our request

After you’ve received the XML, you can use something like Language-Integrated Query (LINQ) to XML to parse through the results. You’ll want the URL for each service for later when you’re calling back to reference that particular service. You can use the same code to get a list of storage accounts in your Azure account by changing the address of the request from /hostedservices to /storageservices.

You’ll be able to use these endpoints to see the storage and service accounts you have. This part of the API is read-only. To create service or storage accounts, you’ll have to use the portal.

Now that you can make simple queries of the management service, let’s flip over to csmanage.exe and use it to deploy a simple web application to Azure.

Other -----------------
- Running a healthy service in the cloud : Transferring diagnostic data
- Running a healthy service in the cloud : Configuring the diagnostic agent (part 3)
- Running a healthy service in the cloud : Configuring the diagnostic agent (part 2) - Diagnostic host configuration
- Running a healthy service in the cloud : Configuring the diagnostic agent (part 1) - Default configuration
- Running a healthy service in the cloud : Diagnostics in the cloud
- SOA Security with .NET and Windows Azure : Windows Identity Foundation (part 3)
- SOA Security with .NET and Windows Azure : Windows Identity Foundation (part 2) - Windows Cardspace & Active Directory Federation Services
- SOA Security with .NET and Windows Azure : Windows Identity Foundation (part 1) - Digital Identity
- SQL Azure and relational data : Common SQL Azure scenarios
- SQL Azure and relational data : Limitations of SQL Azure
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server