2
votes

I am currently working on a project in which I need to accomplish the following using a scheduled task in an Azure Mobile Service (if it's possible):

  1. Update a cloud service deployment configuration to put the cloud service into maintenance mode.

  2. Wait a predetermined length of time for any pending work in the cloud service to complete.

  3. Perform a backup of SQL Azure database used by the cloud service.

  4. Wait another predetermined length of time for the backup to complete.

  5. Update the cloud service deployment configuration to bring the cloud service out of maintenance mode.

I've got step 3 figured out already and steps 2 and 4 are relatively trivial to add. My hangup is with updating the cloud service deployment configuration using the Azure Service Management REST Api.
(I've come across no other means of doing this in a Node.js script).

The calls to the endpoint using the provided Node.js module request (example: http://msdn.microsoft.com/en-us/library/windowsazure/jj631641.aspx) are easy enough but the requests must contain a management certificate as per http://msdn.microsoft.com/en-us/library/windowsazure/ee460782.aspx

So my question is: How do I attach my management certificate to the request?
Keeping in mind that this is to be done within a scheduled task (which is a Node.js script).

1

1 Answers

2
votes

Management certificate is just a standard certificate file (.cer) (X.509 v3). You can put the contents in a string (Don't kill me for suggesting this) or a table which your script would read.

Once you have the certificate content in hand as a string, you can attach it to the HTTPS request you are making to the Azure service management API. Nate Good has a nice post on how to achieve this with nodejs. He is reading the certs from files, so you'll have to change that part and replace it with your cert strings.