May 2014 MSDN Session – Microsoft Philippines

We had a great MSDN session at Microsoft Philippine last week (May 29, 2014, 6:30 PM). This is my first talk in Philippine after relocating from Singapore. I am glad that Jon invited me to speak there and I am more glad that a lot of people (100+?) came for our event.

Here is the list of topics that we presented in this section.

  • Redis by Michael Sync
  • What’s new in Visual Studio 2013 by Xian Gruspe
  • Angular.js by Rudolf Antonio

Here are some photos that we took at our event. I like to say thank you for everyone who came for our session. And I also thank to those who arranged this session and invited me to speak there as well. Hopefully, I will be able to participate more and more in community. 1. Redis Overview Section - Microsoft Philipine

2. Redis - Question 2. and Answer

3. Visual Studio 2013 Features

4. Angular

z (2)

z (7)

z (9)

Microsoft //publish/ satellite event in Manila!

Date: Saturday May 17, 2014, 8:00 am – 6:00 pm
Venue: Microsoft Philippines, 8th Floor, 6750 Ayala Avenue, Makati City

Microsoft Event

Event Overview

It’s a day-long hackathon to work on your Windows 8.1, Windows Phone 8.1, Xamarin cross-platform and Unity for Windows 8 apps! Showcase your apps at the end of the day to have the chance to win either a Dell Venue Pro tablet and a Nokia 1520 handset!

Publish your app before June 1, 2014 and you will be qualified to the global contest to win a trip to the 2014 Formula 1 US Grand Prix in Austin, Texas, a $10,000 “Ultimate Dev Cave” package, a MakerBot 3D Printer, or more Nokia 1520s!

Agenda

(Thanks to Jon Limjap for the description.)

You can find more information at https://publishwindows.com/view/d39e22b189c840c6b4978f8689a38412

I will be at the event as well. Don’t forget to say “Hi!” when you see me. :)

Amazon EC2 + CloudWatch + New Relic: Monitoring, Alert Notifications

We have been on Ec2 for almost two years but recently, we needed to monitor a few stuffs on server so we did a bit of experiences on that and deployed it a couple of months back. We found that we had a pretty good result so I am going to share it here as usual.

Purpose

To monitor the following things on Amazon Ec2 virtual machine and send the alerts based on some conditions.

  • CPU Utilization
  • Memory Available
  • Disk Space Available
  • Network
  • VM Status

Methods of monitoring

There are a few ways to monitor the instances of EC2 but we chose to use Amazon CloudWatch and New Relic.

  • Cloud Watch
  • New Relic

Amazon Cloud Watch

The reason is simple. We chose it because Amazon provides it. There is no cost for monitoring some basic stuffs (Amazon CloudWatch Pricing) so it fits us well.

Basic Monitoring metrics (at five-minute frequency) for Amazon EC2 instances are free of charge, as are all metrics for Amazon EBS volumes, Elastic Load Balancers, and Amazon RDS DB instances.
New and existing customers also receive 10 metrics (applicable to Detailed Monitoring for Amazon EC2 instances or Custom Metrics), 10 alarms, and 1 million API requests each month at no additional charge.

Amazon EC2 Console – Default Monitoring

This is what you will see when you open up the EC2 console. You can enable the monitoring and create the alarms in this console as well.


Amazon EC2 - Monitoring Page

CloudWatch – Monitoring

Once you have enabled the default monitoring in EC2 console, you will see the following metrics in CloudWatch console.

CloudWatch Console for EC2

 

Of course, this is not what we need. We need to monitor the disk space, memory utilization and etc. So we need to create some custom scripts for that.

AWS SDK for .NET

“AWS SDK for .NET” allows you to create the scripts that can create the custom metric on CloudWatch. You can download the SDK from this link ( http://aws.amazon.com/sdkfornet/). We want to monitor the disk space and memory which doesn’t include in EC2 default monitoring so we need to install this SDK and create the script for that.

Amazon CloudWatch Monitoring Scripts for Microsoft Windows Server

You can roll your own script for monitoring what you want to monitor but it’s always a good idea to google before creating your own because if your requirements is very common then someone might be already created the script for that.

I found a brunch of monitoring scripts from this link ( http://aws.amazon.com/code/7932034889155460 ). This package includes the scripts for the following metrics.

  • Memory Utilization (%)
  • Memory Used (MB)
  • Memory Available (MB)
  • Page File Utilization (%)
  • Page File used (MB)
  • Page File available (MB)
  • Disk Space Utilization (%)
  • Disk Space Used (GB)
  • Disk Space Available (GB)
  • Perfmon Counters.

Amazon Access Key ID and Secret Access Key

To run those scripts, you will probably need to provide the access key and it wasn’t that straight forward to find your own secret access key on Amazon so I captured the screenshots of navigation.

3. Security Credentials 4. Amazon Access Kerys ID and Secret Access Key

 

Bugs in Amazon CloudWatch Monitoring Scripts

You will get the following error when you try to load the Amazon powershell module.

Error Screenshot

5. Default Powersshell Error

Error Message in text (for Google. of course! )

Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

Import-Module : The specified module ‘C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell.psd1’ was not loaded
because no valid module file was found in any module directory.
At C:\Users\michael.sync\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:1 char:1
+ Import-Module “C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell.psd1”
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Program File…PowerShell.psd1:String) [Import-Module], FileNot
FoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

PS C:\Users\michael.sync>

Solution

This issue occurs because of the wrong path in powershell profile. Look the screenshot below for the file name and its location and you can fix the path.

6. PowerShell Error RootCause

Note: $env:psmodulePath is the automatic variable which holds the path used to discover modules. If it’s not set, PowerShell looks in c:\windows\system32\WindowsPowerShell\1.0\modules and MyDocuments\WindowsPowerShell\modules

After fixing the wrong, you should be able to run any script from |Amazon monitoring scripts”.

7. PowerShell

if you can manage to run the scripts that you requires the metrics to be appeared then you can trigger those scripts from windows scheduler every 5 mins or so.

And then you will see new custom metrics as below in CloudWatch dashboard. You can go ahead and create some alerts on new custom metric.

8. Windows Custom Matrix

Here is the scripts that I am using for monitoring the memory utilization and disk space.


.\mon-put-metrics-mem.ps1 -aws_credential_file C:\Users\michael.sync\Downloads\AmazonCloudWatchMonitoringWindows\awscreds.conf -mem_util -mem_used -mem_avail -page_avail -page_used -page_util -memory_units Megabytes

.\mon-put-metrics-disk.ps1 -aws_credential_file C:\Users\michael.sync\Downloads\AmazonCloudWatchMonitoringWindows\awscreds.conf -disk_drive C:, D: -disk_space_util -disk_space_used -disk_space_avail -disk_space_units Gigabytes

OK. I know! It’s not very simple so let’s take a look at third-party stuffs.

New Relic

newrelic_logo-300x74

We chose New Relic (http://newrelic.com/) because they officially supports monitoring for EC2 instance in very simple way.

Installers for New Relic – Servers

All you need is to download the installer and install it on your VM. That’s it!

New Reclic EC2

 

You will get the following dashboard after installing the New Relic installer on your server.

 

New Reclic Chart for EC2

Plugins – New Relic

If you are not happy with default monitoring, you can look at thousands of plugins in “plugin central” or you can even create it on your own. (Note: We didn’t use “Amazon EC2” plugin until now but we are planning to test it in a few weeks time.)

New Reclic PLugin

Look cool and simple? Yes! it is.

New Relic has a few different plan that you can choose. As of now, we are using LIFE (a.k.a. Standard) version so we have only 24 hours for data retention. You can look at their prices in this link http://newrelic.com/pricing for details.

New Reclic Price

 

Last question. Is New Relic service expensive for server?

Here is what we found and I think it seems pretty okay.

Is New Reclic expensive

Are you a EC2, Cloud Watch or New Relic user and got a tip to share? please feel free to drop a comment here. Thanks!

Performance Counters Errors

Here is some common errors that you might encounters with Performance Counters on Windows 7 or Windows Server 2008 R2. (I guess you might get the same error on other different version of windows as well.)

1. Unable to create the specified log file.

Error Message

PerformanceCounter - Can't create

[Window Title]
Performance Monitor

[Main Instruction]
When attempting to start the Data Collector Set the following system error occurred:

Unable to create the specified log file.
[OK]

Root cause:

It happens when you create  three or more performance counters with binary log format under one data collector.

 

PerformanceCounter - 4 Counters

PerformanceCounter - Properties

 Solution

You need to change the log format to csv or non-binary format then it will work.

2. Cannot create a file when that file already exists.

Error Message

 

Performance Counter File already exist error

[Window Title]
Performance Monitor

[Main Instruction]
When attempting to start the Data Collector Set the following system error occurred:

Cannot create a file when that file already exists.

[OK]

Root Cause

If the format of sub-directory name in your data collector doesn’t care the NNNNNN (min-sec-etc.)and you have started the performance counter before (meaning there are some existing files under the same directory), you will get this error.

Performance Counter Subdirectory name format

Solution

You can either keep the original sub-directory name format which is yyyyMMdd\-NNNNNN or delete the existing files before starting the performance counters.

Other Error Messages

  • System message: Unable to read counter information and data from input binary log files.
  • System message: The handle is not a valid PDH object.
  • System message: At least one of the input binary log files contain fewer than two data samples.
  • System message: A required argument is missing or not correct.

Root Cause

You may get one of those error messages above when you read the performance graphics while the data collector is still running.

Solution

You need to stop the data collector before viewing the logs.

Ok. It’s weird. You can’t save and view the log at the same time. But this is how performance counters work.

If you encounter any other issue with performance counters and want to share some useful tips then please feel free to drop a comment here.

Thanks!

Continous Delivery: full script for deploying Azure WebRole and WorkerRole from Powershell

After I posted Windows Azure Deployment – Problem and Solution #1 and Windows Azure Deployment – Problem and Solution #2 here last week, one of my blog readers emailed me whether or not I have the full script for deploying the WebRole or Worker Role on Windows Azure.

Yes. I still have it but I stopped using webrole and worker role because deploying web role or worker role takes so much time (around 20-40 min) which is unacceptable for us. Anyways,  if 20-40 min deployment time is not your concern then sure, you can use it.

I wrote and tested this script with Azure SDK 2.1 on Windows 2012 server.

You can download it from my github repository as well. Here is the link https://github.com/michaelsync/Michael-Sync-s-blog-sample/blob/master/azure_deploy.ps1


#Modified and simplified version of https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/

$thumbprint = "{Your Cert's Thumbprint}"
$myCert = Get-Item cert:\\CurrentUser\My\$thumbprint
$subscriptionId = "{Your Subscription Id}"
$subscriptionName = "{Your Subscription Name}"
$webroleservice = "{Your Web Role Name}"
$workerroleservice = "{Your Worker Role Name}"

$slot = "staging" #staging or production

$package = "{Path of your Azure project}\bin\Release\app.publish\{Your Project}.cspkg"
$configuration = {Path of your Azure project}\bin\Release\app.publish\ServiceConfiguration.Cloud.cscfg"

$timeStampFormat = "g"

Write-Output "Running Azure Imports"
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
Import-AzurePublishSettingsFile "{Path where you stored your azure setting\Azure.publishsettings"

function Publish(){
 PublishInternal $webroleservice
 PublishInternal $workerroleservice
}

function PublishInternal($service){

Write-Output "Publising"
 Write-Output $service

Set-AzureSubscription -CurrentStorageAccount $service -SubscriptionName $subscriptionName -SubscriptionId $subscriptionId -Certificate $myCert
 Write-Output "Set-AzureSubscription"
 $deploymentLabel = "ContinuousDeploy to $service v%build.number%"

Write-Output $deploymentLabel

$deployment = Get-AzureDeployment -ServiceName $service -Slot $slot -ErrorVariable a -ErrorAction silentlycontinue
 Write-Output a

if ($a[0] -ne $null) {
 Write-Output "$(Get-Date -f $timeStampFormat) - No deployment is detected. Creating a new deployment. "
 }

 if ($deployment.Name -ne $null) {
 #Update deployment inplace (usually faster, cheaper, won't destroy VIP)
 Write-Output "$(Get-Date -f $timeStampFormat) - Deployment exists in $servicename. Upgrading deployment."
 UpgradeDeployment $service $deploymentLabel
 } else {
 CreateNewDeployment $service $deploymentLabel
 }
}
function CreateNewDeployment($service, $deploymentLabel)
{
 write-progress -id 3 -activity "Creating New Deployment" -Status "In progress"
 Write-Output "$(Get-Date -f $timeStampFormat) - Creating New Deployment: In progress"

$opstat = New-AzureDeployment -Slot $slot -Package $package -Configuration $configuration -label $deploymentLabel -ServiceName $service

$completeDeployment = Get-AzureDeployment -ServiceName $service -Slot $slot
 $completeDeploymentID = $completeDeployment.deploymentid

write-progress -id 3 -activity "Creating New Deployment" -completed -Status "Complete"
 Write-Output "$(Get-Date -f $timeStampFormat) - Creating New Deployment: Complete, Deployment ID: $completeDeploymentID"
}

function UpgradeDeployment($service, $deploymentLabel)
{
 write-progress -id 3 -activity "Upgrading Deployment" -Status "In progress"
 Write-Output "$(Get-Date -f $timeStampFormat) - Upgrading Deployment: In progress"

# perform Update-Deployment
 $setdeployment = Set-AzureDeployment -Upgrade -Slot $slot -Package $package -Configuration $configuration -label $deploymentLabel -ServiceName $service -Force

$completeDeployment = Get-AzureDeployment -ServiceName $service -Slot $slot
 $completeDeploymentID = $completeDeployment.deploymentid

write-progress -id 3 -activity "Upgrading Deployment" -completed -Status "Complete"
 Write-Output "$(Get-Date -f $timeStampFormat) - Upgrading Deployment: Complete, Deployment ID: $completeDeploymentID"
}

Write-Output "Create Azure Deployment"
Publish

Here is the log for deploying webrole from Visual Studio.

New Deployment

10:56:32 PM – Warning: There are package validation warnings.
10:56:32 PM – Checking for Remote Desktop certificate…
10:56:33 PM – Uploading Certificates…
10:56:51 PM – Preparing deployment for MvcApplication1.Azure – 10/7/2013 10:56:06 PM with Subscription ID ‘1775dfasa8a81fd58’ using Service Management URL ‘https://management.core.windows.net/’…
10:56:51 PM – Connecting…
10:56:51 PM – Verifying storage account ‘mymvctestx01’…
10:56:52 PM – Uploading Package…
11:04:04 PM – Creating…
11:04:54 PM – Created Deployment ID: 337b850dfa3c4dd38dd35441b5b8e337.
11:04:54 PM – Instance 0 of role MvcApplication1 is stopped
11:04:55 PM – Starting…
11:05:45 PM – Initializing…
11:05:45 PM – Instance 0 of role MvcApplication1 is creating the virtual machine
11:06:18 PM – Instance 0 of role MvcApplication1 is starting the virtual machine
11:07:57 PM – Instance 0 of role MvcApplication1 is busy
11:09:37 PM – Instance 0 of role MvcApplication1 is ready
11:09:37 PM – Created Website URL: http://mymvctestx01.cloudapp.net/
11:09:37 PM – Complete.

Upgrading

11:12:40 PM – Warning: There are package validation warnings.
11:12:40 PM – Checking for Remote Desktop certificate…
11:12:42 PM – Preparing deployment for MvcApplication1.Azure – 10/7/2013 11:12:14 PM with Subscription ID ‘17751asdfs8a81fd58’ using Service Management URL ‘https://management.core.windows.net/’…
11:12:42 PM – Connecting…
11:12:42 PM – Verifying storage account ‘mymvctestx01’…
11:12:44 PM – Uploading Package…
11:20:08 PM – Updating…
11:23:19 PM – Instance 0 of role MvcApplication1 is ready
11:23:21 PM – Starting…
11:23:39 PM – Initializing…
11:23:40 PM – Created Website URL: http://mymvctestx01.cloudapp.net/
11:23:40 PM – Complete.

Generally, it takes around 10 to 20 mins but sometimes, it takes around 40 mins. I am not the only one who experienced this problem. You search about it online. Hope that Azure team will do something about it.

Windows Azure Deployment – Problem and Solution #2

The post is the second post of my “Windows Azure Deployment – Problem and Solution” series. You also read the first post in this link.

Contents

Problem: Issue with multiple Azure subscriptions with same name

Duplicated Subscription Name

The code below is for getting the azure deployment to determine whether we need to publish new package or update the existing page.


$subscription = "[Your Subscription Name]"
$service = "[Your Azure Service Name]"
$slot = "staging" #staging or production
$package = "[ProjectName]\bin\[BuildConfigName]\app.publish\[ProjectName].cspkg"
$configuration = "[ProjectName]\bin\[BuildConfigName]\app.publish\ServiceConfiguration.Cloud.cscfg"
$timeStampFormat = "g"
$deploymentLabel = "ContinuousDeploy to $service v%build.number%"

Write-Output "Running Azure Imports"
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\*.psd1"
Import-AzurePublishSettingsFile "C:\TeamCity\[PSFileName].publishsettings"
Set-AzureSubscription -CurrentStorageAccount $service -SubscriptionName $subscription

function Publish(){
 $deployment = Get-AzureDeployment -ServiceName $service -Slot $slot -ErrorVariable a -ErrorAction silentlycontinue

But I got the following error at the line where I call Get-AzureDeployment.

Error Message

VERBOSE: 3:26:54 PM – Begin Operation: Get-AzureDeployment
Get-AzureDeployment : “An exception occurred when calling the ServiceManagement API. HTTP Status Code: 404. Service
Management Error Code: ResourceNotFound. Message: No deployments were found.. Operation Tracking ID:
b27b43c1bf5a47fb97167ede7e364206.”
At C:\BuildAgent\work\e02c76f07d491d1d\scripts\azure_deploy.ps1:57 char:27
+ $completeDeployment = Get-AzureDeployment -ServiceName $service -Slot $slot
+ ~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureDeployment], ServiceManagementClientException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.GetAzureDeploymentCom
mand

VERBOSE: 3:26:54 PM – Completed Operation: Get-AzureDeployment

Solution

I tried deploying the project from Visual Studio a couple of times and sometimes, the publish wizard can’t detect the service that I created so I assumed that both Azure powershell cmdlet and the publish wizard from VS got the same issue. then I realized that it is because I have multiple subscription that have the same name.. Surprisingly, the most of Azure API are based on “subscriptionName ” instead of the name.. ( man.. there are a lot of funny stuffs in Azure but I can see that there are a lot of improvements being done during this year.. )

The solution for this issue is that you need to set the id when you call Set-AzureSubscription API. The updated code will be looked like that below.


$subscriptionId = "[Your Subscription Id]"
$subscriptionName = "[Your Subscription Name]"

$service = "[Your Azure Service Name]"
$slot = "staging" #staging or production
$package = "[ProjectName]\bin\[BuildConfigName]\app.publish\[ProjectName].cspkg"
$configuration = "[ProjectName]\bin\[BuildConfigName]\app.publish\ServiceConfiguration.Cloud.cscfg"
$timeStampFormat = "g"
$deploymentLabel = "ContinuousDeploy to $service v%build.number%"

Write-Output "Running Azure Imports"
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\*.psd1"
Import-AzurePublishSettingsFile "C:\TeamCity\[PSFileName].publishsettings"
Set-AzureSubscription -CurrentStorageAccount $service -SubscriptionName $subscriptionName -SubscriptionId $subscriptionId

function Publish(){
$deployment = Get-AzureDeployment -ServiceName $service -Slot $slot -ErrorVariable a -ErrorAction silentlycontinue

Problem: CurrentStorageAccount is not set

data servers

The error message that I got is “Current storage account is not set”. It’s a bit misleading because as you can see in the code below (esp: last line), I did set the current storage but why did I get this message?

Error Message

New-AzureDeployment : CurrentStorageAccount is not set. Use Set-AzureSubscription subname -CurrentStorageAccount
storageaccount to set it.
At C:\BuildAgent\work\e02c76f07d491d1d\scripts\azure_deploy.ps1:55 char:15
+ $opstat = New-AzureDeployment -Slot $slot -Package $package -Configuration $ …
+ ~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureDeployment], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.NewAzureDeploymentCom
mand

Solution

The problem was that I have many subscription accounts and I created the storage account in wrong subscription account. The solution is just to create new storage account in correct subscription account from Azure web console.

Problem: Authentication and Certificate Issues

Security

The error message that I got is “Current storage account is not set”. It’s a bit misleading because as you can see in the code below (esp: last line), I did set the current storage but why did I get this message?

Error Messages

New-AzureDeployment : “An exception occurred when calling the ServiceManagement API. HTTP Status Code: 403. Service
Management Error Code: AuthenticationFailed. Message: The server failed to authenticate the request. Verify that the
certificate is valid and is associated with this subscription.. Operation Tracking ID: <NONE>.”
At line:1 char:1
+ New-AzureDeployment -Slot “staging” -Package “MyProject.Azure\bin\Release\app.publish …
+ ~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureDeployment], ServiceManagementClientException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.NewAzureDeploymentCommand

New-AzureDeployment : “An exception occurred when calling the ServiceManagement API. HTTP Status Code: 400. Service
Management Error Code: BadRequest. Message: The certificate with thumbprint 426bed136649263b9a154f5fdc1f2707a6ecf482
was not found.. Operation Tracking ID: f5925a7eb5a44dcf8c56c6e950cc8229.”
At C:\BuildAgent\work\e02c76f07d491d1d\Scripts\azure_deploy.ps1:62 char:15
+ $opstat = New-AzureDeployment -Slot $slot -Package $package -Configuration $ …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureDeployment], ServiceManagementClientException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.NewAzureDeploymentCom
mand

Solution #1

  • Add-AzureCertificate -serviceName <CLOUDSERVICENAME> -certToDeploy (get-item cert:\CurrentUser\MY\<THUMBPRINT>)
  • Add-AzureCertificate -serviceName hivewebrole -certToDeploy (get-item “cert:\Local Machine\Personal\426BED136649263B9A154F5FDC1F2707A6ECF482”)

And need to pass the certificate information from powershell script. I will show you the updated script later.

Solution #2

It doesn’t matter which solution you choose. You will still need to pass the cert from your script.

Here is the updated script that contains the code for passing the cert.


$thumbprint = &quot;[The tumbprint of your certificate.]&quot;
$myCert = Get-Item cert:\\CurrentUser\My\$thumbprint

$subscriptionId = &quot;[Your Subscription Id]&quot;
$subscriptionName = &quot;[Your Subscription Name]&quot;

$service = &quot;[Your Azure Service Name]&quot;
$slot = &quot;staging&quot; #staging or production
$package = &quot;[ProjectName]\bin\[BuildConfigName]\app.publish\[ProjectName].cspkg&quot;
$configuration = &quot;[ProjectName]\bin\[BuildConfigName]\app.publish\ServiceConfiguration.Cloud.cscfg&quot;
$timeStampFormat = &quot;g&quot;
$deploymentLabel = &quot;ContinuousDeploy to $service v%build.number%&quot;

Write-Output &quot;Running Azure Imports&quot;
Import-Module &quot;C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\*.psd1&quot;
Import-AzurePublishSettingsFile &quot;C:\TeamCity\[PSFileName].publishsettings&quot;

Set-AzureSubscription -CurrentStorageAccount $service -SubscriptionName $subscriptionName -SubscriptionId $subscriptionId -Certificate $myCert

Write-Output &quot;Set-AzureSubscription&quot;

function Publish(){
$deployment = Get-AzureDeployment -ServiceName $service -Slot $slot -ErrorVariable a -ErrorAction silentlycontinue

Additional, you might get the error below when you import the Azure publish setting file after making changes in certificate.

PS C:\Windows\system32> Import-AzurePublishSettingsFile “C:\Users\root\Downloads\Visual Studio Ultimate with MSDN-Windows
Azure MSDN – Visual Studio Ultimate-BizSpark–credentials.publishsettings”
Import-AzurePublishSettingsFile : No certificate was found in the certificate store with thumbprint
EB3E353EE50CB344F246D0D975557CBAB1C38494
At line:1 char:1
+ Import-AzurePublishSettingsFile “C:\Users\root\Downloads\Visual Studio Ultimate w …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Import-AzurePublishSettingsFile], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.Subscription.ImportAzurePublishSettingsCommand

The solution for that you need to do either one of them that I listed below.

  • Close and re-open the powershell  — OR —
  • Delete all files under C:\Users\[User]\AppData\Roaming\Windows Azure Powershell,   — OR —
  • Restart the server

Problem: Server Busy

DDos attack

( Yes. I captured the screenshot of “DDoS Attack Visualization” video from Logstalgia  because it’s pretty cool. You should go and check out the project as well. )

But no. Windows Azure wasn’t under DDOS attack.

Error Message

Set-AzureDeployment : “An exception occurred when calling the ServiceManagement API. HTTP Status Code: 503. Servi
Management Error Code: ServerBusy. Message: The server is currently unavailable to receive requests. Please retry
request.. Operation Tracking ID: 9b4dfd5616b34c87bfaf6f808a9d22be.”
At C:\BuildAgent\work\e02c76f07d491d1d\Scripts\azure_deploy.ps1:77 char:22
+ $setdeployment = Set-AzureDeployment -Upgrade -Slot $slot -Package $package …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureDeployment], ServiceManagementClientException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.SetAzureDeploymemand

Solution

The only solution is that you need to wait a bit and try to deploy it again.

I think that’s pretty much it.. I haven’t played around with SDK 2.2 yet.. I will leave this series open and if I got something new then I will post it here again..

Thanks!