Created
January 22, 2015 11:20
-
-
Save chgeuer/c53d0907fc01ffd6a4b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Func<string, Task<bool>> CheckNameAvailabilityAsync = async (cloudServiceName) => | |
{ | |
var computeManagementClient = new Microsoft.WindowsAzure.Management.Compute.ComputeManagementClient( // Microsoft.WindowsAzure.Management.Compute.8.0.0 | |
new Microsoft.Azure.CertificateCloudCredentials( // Microsoft.Azure.Common.2.0.1 | |
subscriptionID, subscriptionManagementCertificateThumbprint.FindX509CertificateByThumbprint(storeLocation))); | |
var result = await computeManagementClient.HostedServices.CheckNameAvailabilityAsync(cloudServiceName, cancellationToken); | |
return result.IsAvailable; | |
}; | |
Func<string, string> CreateCloudServiceName = (prefix) => | |
{ | |
return string.Join("-", prefix, System.DateTime.UtcNow.ToString("yyMMddhhmmssfff"), Guid.NewGuid().ToString()); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment