Ejemplo n.º 1
0
        private static StorageAccountCreateParameters CreateStorageAccountParameters(DeveloperParameters developerOptions)
        {
            var parameters = new StorageAccountCreateParameters
            {
                Description = developerOptions.Description,
                Location    = developerOptions.Location,
                Label       = developerOptions.StorageAccountName,
                Name        = developerOptions.StorageAccountName,
                AccountType = "Standard_LRS"
            };

            if (developerOptions.AffinityGroup != null)
            {
                parameters.AffinityGroup = developerOptions.AffinityGroup;
            }
            else if (developerOptions.Location != null)
            {
                parameters.Location = developerOptions.Location;
            }
            else
            {
                throw new ArgumentException("Must have a value for either AffinityGroup or Location. Please verify your settings in the manifest file.");
            }
            return(parameters);
        }
Ejemplo n.º 2
0
        internal static OperationResult DeleteBlobContainer(DeveloperParameters developerParameters) //pretty much the same as CreateBlobContainer
        {
            OperationResult     result = new OperationResult();
            CloudStorageAccount account;
            CloudBlobClient     client;
            CloudBlobContainer  container;
            bool containerDeleted;

            result.EndUserMessage += "Attempting to access Storage account\n";
            try
            {
                account = CloudStorageAccount.Parse("" /*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Accessing Blob Client\n";
            try
            {
                client = account.CreateCloudBlobClient(); //make a blob service client
                result.EndUserMessage += "Successfully accessed Blob Client\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Deleting blob container\n";

            try
            {
                container        = client.GetContainerReference(developerParameters.ContainerName); //get a reference to a container with the given name
                containerDeleted = container.DeleteIfExists();                                      //if the container exists, delete it.  We store the boolean result of this so we can handle if it doesn't get deleted (in case it doesn't also throw an exception here)
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            if (!containerDeleted) //check if the container got deleted. If not:
            {
                result.EndUserMessage += "Container was not deleted.  A container with this name may not currently exist\n";
                result.IsSuccess       = false;
                return(result);
            }

            //if we passed all these steps, it should have successfully deleted the container
            result.EndUserMessage += "Blob deleted successfully\n";
            result.IsSuccess       = true;
            return(result);
        }
        internal static OperationResult CreateQueue(DeveloperParameters developerParameters)
        {
            OperationResult result = new OperationResult();
            CloudStorageAccount account;
            CloudQueueClient client;
            CloudQueue queue;
            bool queueCreated;

            try
            {
                account = CloudStorageAccount.Parse(""/*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Accessing Queue Client\n";
            try
            {
                client = account.CreateCloudQueueClient(); //make a queue client
                result.EndUserMessage += "Successfully accessed Queue Client\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Creating queue\n";

            try
            {
                queue = client.GetQueueReference(developerParameters.ContainerName); //get a reference to a queue with the given name
                queueCreated = queue.CreateIfNotExists(); //if the queue doesn't exist, create it.  We store the boolean result of this so we can handle if it doesn't get created (in case it doesn't also throw an exception here)
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            if (!queueCreated)
            { //check if the queue got created. If not:
                result.EndUserMessage += "Queue was not created.  A queue with this name may already exist\n";
                result.IsSuccess = false;
                return result;
            }

            //if we passed all these steps, it should have successfully created a queue
            result.EndUserMessage += "Queue created successfully\n";
            result.IsSuccess = true;
            return result;
        }
Ejemplo n.º 4
0
        internal static OperationResult DeleteQueue(DeveloperParameters developerParameters)
        {
            OperationResult     result = new OperationResult();
            CloudStorageAccount account;
            CloudQueueClient    client;
            CloudQueue          queue;
            bool queueDeleted;

            try
            {
                account = CloudStorageAccount.Parse("" /*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Accessing Queue Client\n";
            try
            {
                client = account.CreateCloudQueueClient(); //make a queue client
                result.EndUserMessage += "Successfully accessed Queue Client\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Deleting queue\n";

            try
            {
                queue        = client.GetQueueReference(developerParameters.ContainerName); //get a reference to a container with the given name
                queueDeleted = queue.DeleteIfExists();                                      //if the queue exists, delete it.
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            if (!queueDeleted)
            { //check if the queue got deleted. If not:
                result.EndUserMessage += "Queue was not deleted.  A queue with this name may not already exist\n";
                result.IsSuccess       = false;
                return(result);
            }

            //if we passed all these steps, it should have successfully created a container
            result.EndUserMessage += "Queue deleted successfully\n";
            result.IsSuccess       = true;
            return(result);
        }
Ejemplo n.º 5
0
        internal static OperationResult DeleteTable(DeveloperParameters developerParameters)
        {
            OperationResult     result = new OperationResult();
            CloudStorageAccount account;
            CloudTableClient    client;
            CloudTable          table;
            bool tableDeleted;

            try
            {
                account = CloudStorageAccount.Parse("" /*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Accessing Table Client\n";
            try
            {
                client = account.CreateCloudTableClient(); //make a table client
                result.EndUserMessage += "Successfully accessed Table Client\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Deleting table\n";

            try
            {
                table        = client.GetTableReference(developerParameters.ContainerName); //get a reference to a table with the given name
                tableDeleted = table.DeleteIfExists();                                      //if the table exists, delete it.  We store the boolean result of this so we can handle if it doesn't get created (in case it doesn't also throw an exception here)
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            if (!tableDeleted)
            { //check if the table got deleted. If not:
                result.EndUserMessage += "Table was not deleted.  A table with this name may not already exist\n";
                result.IsSuccess       = false;
                return(result);
            }

            //if we passed all these steps, it should have successfully deleted
            result.EndUserMessage += "Table deleted successfully\n";
            result.IsSuccess       = true;
            return(result);
        }
        // AI-121
        internal static OperationResult CreateBlobContainer(DeveloperParameters developerParameters)
        {
            OperationResult result = new OperationResult();
            CloudStorageAccount account;
            CloudBlobClient client;
            CloudBlobContainer container;
            bool containerCreated;
            result.EndUserMessage += "Attempting to access Storage account\n";

            try
            {
                account = CloudStorageAccount.Parse(""/*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Accessing Blob Client\n";
            try
            {
                client = account.CreateCloudBlobClient(); //make a blob service client
                result.EndUserMessage += "Successfully accessed Blob Client\n";
            }
             catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Creating blob container\n";

            try
            {
            container = client.GetContainerReference(developerParameters.ContainerName); //get a reference to a container with the given name
            containerCreated = container.CreateIfNotExists(); //if the container doesn't exist, create it.  We store the boolean result of this so we can handle if it doesn't get created (in case it doesn't also throw an exception here)
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            if(!containerCreated){ //check if the container got created. If not:
                result.EndUserMessage += "Container was not created.  A container with this name may already exist\n";
                result.IsSuccess = false;
                return result;
            }

            //if we passed all these steps, it should have successfully created a container
            result.EndUserMessage += "Blob created successfully\n";
            result.IsSuccess = true;
            return result;
        }
Ejemplo n.º 7
0
        internal static OperationResult CreateQueue(DeveloperParameters developerParameters)
        {
            OperationResult     result = new OperationResult();
            CloudStorageAccount account;
            CloudQueueClient    client;
            CloudQueue          queue;
            bool queueCreated;

            try
            {
                account = CloudStorageAccount.Parse("" /*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Accessing Queue Client\n";
            try
            {
                client = account.CreateCloudQueueClient(); //make a queue client
                result.EndUserMessage += "Successfully accessed Queue Client\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            result.EndUserMessage += "Creating queue\n";

            try
            {
                queue        = client.GetQueueReference(developerParameters.ContainerName); //get a reference to a queue with the given name
                queueCreated = queue.CreateIfNotExists();                                   //if the queue doesn't exist, create it.  We store the boolean result of this so we can handle if it doesn't get created (in case it doesn't also throw an exception here)
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess       = false;
                return(result);
            }

            if (!queueCreated)
            { //check if the queue got created. If not:
                result.EndUserMessage += "Queue was not created.  A queue with this name may already exist\n";
                result.IsSuccess       = false;
                return(result);
            }

            //if we passed all these steps, it should have successfully created a queue
            result.EndUserMessage += "Queue created successfully\n";
            result.IsSuccess       = true;
            return(result);
        }
Ejemplo n.º 8
0
        public override ProvisionAddOnResult Provision(AddonProvisionRequest request)
        {
            var provisionResult = new ProvisionAddOnResult("");

            try
            {
                var devParameters = DeveloperParameters.Parse(request.DeveloperParameters, request.Manifest.GetProperties());

                SubscriptionCloudCredentials creds = CertificateAuthenticationHelper.GetCredentials(devParameters.AzureManagementSubscriptionId, devParameters.AzureAuthenticationKey, devParameters.PFXPassword);

                // ok so if we need a storage account, we need to use the storage management client.
                if (devParameters.NewStorageAccountFlag)
                {
                    var client     = new StorageManagementClient(creds);
                    var parameters = CreateStorageAccountParameters(devParameters);
                    client.StorageAccounts.Create(parameters);
                    do
                    {
                        var verificationResponse = client.StorageAccounts.Get(parameters.Name);

                        if (verificationResponse.StorageAccount.Properties.Status.Equals(StorageAccountStatus.Created))
                        {
                            var azureconnectioninfo = client.StorageAccounts.Get(devParameters.StorageAccountName);
                            var keysForStorageUnit  = client.StorageAccounts.GetKeys(devParameters.StorageAccountName);

                            var connectionInfo = new ConnectionInfo
                            {
                                PrimaryKey         = keysForStorageUnit.PrimaryKey,
                                SecondaryKey       = keysForStorageUnit.SecondaryKey,
                                StorageAccountName = azureconnectioninfo.StorageAccount.Name,
                                Uri = keysForStorageUnit.Uri.ToString()
                            };
                            provisionResult.ConnectionData = connectionInfo.ToString();
                            provisionResult.IsSuccess      = true;
                            break;
                        }
                        Thread.Sleep(TimeSpan.FromSeconds(10d));
                    } while (true);
                }
            }
            catch (Exception e)
            {
                provisionResult.IsSuccess      = false;
                provisionResult.EndUserMessage = e.Message + "\n We're in an error\n";
            }

            return(provisionResult);
        }
Ejemplo n.º 9
0
        public override OperationResult Test(AddonTestRequest request)
        {
            var manifest        = request.Manifest;
            var developerParams = request.DeveloperParameters;
            var testResult      = new OperationResult {
                IsSuccess = false
            };
            var testProgress       = "";
            var manifestProperties = manifest.Properties;

            if (manifestProperties != null)
            {
                var devOptions = DeveloperParameters.Parse(developerParams, manifest.GetProperties());
                var creds      = CertificateAuthenticationHelper.GetCredentials(devOptions.AzureManagementSubscriptionId,
                                                                                devOptions.AzureAuthenticationKey, devOptions.PFXPassword);
                try
                {
                    testProgress += "Establishing connection to Azure...\n";
                    // set up the credentials for azure

                    var client = new StorageManagementClient(creds);

                    //var listOfStorageAccounts = client.StorageAccounts.List();

                    testProgress             += "Successfully passed all testing criteria!";
                    testResult.IsSuccess      = true;
                    testResult.EndUserMessage = testProgress;
                }
                catch (Exception e)
                {
                    // adding a forced failure here.
                    testResult.IsSuccess      = false;
                    testResult.EndUserMessage = testProgress + "\nEXCEPTION: " + e.Message;
                }
            }
            else
            {
                testResult.IsSuccess      = false;
                testResult.EndUserMessage = "Missing required manifest properties (requireDevCredentials)";
            }

            return(testResult);
        }
Ejemplo n.º 10
0
 public static DeveloperParameters Parse(IEnumerable<AddonParameter> parameters, IEnumerable<IAddOnPropertyDefinition> manifestProperties)
 {
     // LINQ is your friend.
     var options = new DeveloperParameters();
     if (parameters != null)
     {
         foreach (var param in parameters)
         {
             options = MapToOption(options, param.Key.ToLowerInvariant(), param.Value);
         }
     }
     if (manifestProperties != null)
     {
         foreach (var prop in manifestProperties)
         {
             options = MapToOption(options, prop.Key.ToLowerInvariant(), prop.Value);
         }
     }
     return options;
 }
Ejemplo n.º 11
0
        public static DeveloperParameters Parse(IEnumerable <AddonParameter> parameters, IEnumerable <IAddOnPropertyDefinition> manifestProperties)
        {
            // LINQ is your friend.
            var options = new DeveloperParameters();

            if (parameters != null)
            {
                foreach (var param in parameters)
                {
                    options = MapToOption(options, param.Key.ToLowerInvariant(), param.Value);
                }
            }
            if (manifestProperties != null)
            {
                foreach (var prop in manifestProperties)
                {
                    options = MapToOption(options, prop.Key.ToLowerInvariant(), prop.Value);
                }
            }
            return(options);
        }
Ejemplo n.º 12
0
        public override OperationResult Deprovision(AddonDeprovisionRequest request)
        {
            var connectionData    = request.ConnectionData;
            var deprovisionResult = new ProvisionAddOnResult(connectionData);
            var devOptions        = DeveloperParameters.Parse(request.DeveloperParameters, request.Manifest.GetProperties());
            // set up the credentials for azure
            SubscriptionCloudCredentials creds = CertificateAuthenticationHelper.GetCredentials(devOptions.AzureManagementSubscriptionId, devOptions.AzureAuthenticationKey, devOptions.PFXPassword);
            // set up the storage management client
            var client = new StorageManagementClient(creds);

            // check to see if the storage accounts exists...if they do not exist, throw a no-op here.
            var account = client.StorageAccounts.Get(devOptions.StorageAccountName);

            if (account.StatusCode.Equals(HttpStatusCode.NotFound))
            {
                // no account found. return a no-op as something went wrong, proceed to deletion
                deprovisionResult.IsSuccess      = true;
                deprovisionResult.EndUserMessage = "Storage account not found, may have been deleted via 3rd party.";
                return(deprovisionResult);
            }

            // then if requested, delete the storage account name
            client.StorageAccounts.Delete(devOptions.StorageAccountName);

            do
            {
                var verificationResponse = client.StorageAccounts.Get(devOptions.StorageAccountName);

                if (verificationResponse.StorageAccount.Properties.Status.Equals(StorageAccountStatus.Deleting))
                {
                    deprovisionResult.IsSuccess      = true;
                    deprovisionResult.EndUserMessage = "Deprovision Request Complete, please allow a few minutes for resources to be fully deleted.";
                    break;
                }
                Thread.Sleep(TimeSpan.FromSeconds(10d));
            }while (true);
            return(deprovisionResult);
        }
Ejemplo n.º 13
0
 private static StorageAccountCreateParameters CreateStorageAccountParameters(DeveloperParameters developerOptions)
 {
     var parameters = new StorageAccountCreateParameters
     {
         Description = developerOptions.Description,
         Location = developerOptions.Location,
         Label = developerOptions.StorageAccountName,
         Name = developerOptions.StorageAccountName
     };
     if (developerOptions.AffinityGroup != null)
     {
         parameters.AffinityGroup = developerOptions.AffinityGroup;
     }
     else if (developerOptions.Location != null)
     {
         parameters.Location = developerOptions.Location;
     }
     else
     {
         throw new ArgumentException("Must have a value for either AffinityGroup or Location. Please verify your settings in the manifest file.");
     }
     return parameters;
 }
Ejemplo n.º 14
0
        private static DeveloperParameters MapToOption(DeveloperParameters options, string key, string value)
        {
            if ("newstorageaccount".Equals(key))
            {
                bool result;
                if (!bool.TryParse(value, out result))
                {
                    throw new ArgumentException("Tried to pass in a non-boolean value for this option. Please check your options.");
                }
                options.NewStorageAccountFlag = result;
                return(options);
            }
            if ("storageaccountname".Equals(key))
            {
                options.StorageAccountName = value;
                return(options);
            }
            if ("containername".Equals(key))
            {
                options.ContainerName = value;
                return(options);
            }
            if ("azuremanagementsubscriptionid".Equals(key))
            {
                options.AzureManagementSubscriptionId = value;
                return(options);
            }
            if ("azuremanagementcertificatefile".Equals(key))
            {
                options.AzureAuthenticationKey = value;
                return(options);
            }
            if ("azuremanagementpfxpassword".Equals(key))
            {
                options.PFXPassword = value;
                return(options);
            }

            if ("azureurl".Equals(key))
            {
                options.AzureUrl = value;
                return(options);
            }
            if ("description".Equals(key))
            {
                options.Description = value;
                return(options);
            }
            if ("affinitygroup".Equals(key))
            {
                options.AffinityGroup = value;
                return(options);
            }
            if ("georeplicationenabled".Equals(key))
            {
                bool result;
                if (!bool.TryParse(value, out result))
                {
                    throw new ArgumentException("Tried to pass in a non-boolean value for this option. Please refactor manifest file.");
                }
                options.GeoReplicationEnabled = result;
                return(options);
            }
            if ("location".Equals(key))
            {
                options.Location = value;
                return(options);
            }
            if ("developerid".Equals(key))
            {
                options.DeveloperId = value;
                return(options);
            }
            if ("developeralias".Equals(key))
            {
                options.DeveloperAlias = value;
                return(options);
            }
            if ("instancealias".Equals(key))
            {
                return(options);
            }
            throw new ArgumentException(string.Format("The option provided '{0}' does not parse, please try your request again.", key));
        }
Ejemplo n.º 15
0
        internal static OperationResult DeleteTable(DeveloperParameters developerParameters)
        {
            OperationResult result = new OperationResult();
            CloudStorageAccount account;
            CloudTableClient client;
            CloudTable table;
            bool tableDeleted;

            try
            {
                account = CloudStorageAccount.Parse(""/*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Accessing Table Client\n";
            try
            {
                client = account.CreateCloudTableClient(); //make a table client
                result.EndUserMessage += "Successfully accessed Table Client\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Deleting table\n";

            try
            {
                table = client.GetTableReference(developerParameters.ContainerName); //get a reference to a table with the given name
                tableDeleted = table.DeleteIfExists(); //if the table exists, delete it.  We store the boolean result of this so we can handle if it doesn't get created (in case it doesn't also throw an exception here)
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            if (!tableDeleted)
            { //check if the table got deleted. If not:
                result.EndUserMessage += "Table was not deleted.  A table with this name may not already exist\n";
                result.IsSuccess = false;
                return result;
            }

            //if we passed all these steps, it should have successfully deleted
            result.EndUserMessage += "Table deleted successfully\n";
            result.IsSuccess = true;
            return result;
        }
Ejemplo n.º 16
0
        internal static OperationResult DeleteQueue(DeveloperParameters developerParameters)
        {
            OperationResult result = new OperationResult();
            CloudStorageAccount account;
            CloudQueueClient client;
            CloudQueue queue;
            bool queueDeleted;

            try
            {
                account = CloudStorageAccount.Parse(""/*need a connection string here*/); //get the account
                result.EndUserMessage += "Account accessed successfully\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Accessing Queue Client\n";
            try
            {
                client = account.CreateCloudQueueClient(); //make a queue client
                result.EndUserMessage += "Successfully accessed Queue Client\n";
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            result.EndUserMessage += "Deleting queue\n";

            try
            {
                queue = client.GetQueueReference(developerParameters.ContainerName); //get a reference to a container with the given name
                queueDeleted = queue.DeleteIfExists(); //if the queue exists, delete it.
            }
            catch (Exception e)
            {
                result.EndUserMessage += e.Message;
                result.IsSuccess = false;
                return result;
            }

            if (!queueDeleted)
            { //check if the queue got deleted. If not:
                result.EndUserMessage += "Queue was not deleted.  A queue with this name may not already exist\n";
                result.IsSuccess = false;
                return result;
            }

            //if we passed all these steps, it should have successfully created a container
            result.EndUserMessage += "Queue deleted successfully\n";
            result.IsSuccess = true;
            return result;
        }
Ejemplo n.º 17
0
 private static DeveloperParameters MapToOption(DeveloperParameters options, String key, String value)
 {
     if("newstorageaccount".Equals(key))
     {
         bool result;
         if (!bool.TryParse(value, out result))
         {
             throw new ArgumentException("Tried to pass in a non-boolean value for this option. Please check your options.");
         }
         options.NewStorageAccountFlag = result;
         return options;
     }
     if ("storageaccountname".Equals(key))
     {
         options.StorageAccountName = value;
         return options;
     }
     if ("containername".Equals(key))
     {
         options.ContainerName = value;
         return options;
     }
     if ("azuremanagementsubscriptionid".Equals(key))
     {
         options.AzureManagementSubscriptionId = value;
         return options;
     }
     if ("azureauthenticationkey".Equals(key))
     {
         options.AzureAuthenticationKey = value;
         return options;
     }
     if ("azureurl".Equals(key))
     {
         options.AzureUrl = value;
         return options;
     }
     if ("description".Equals(key))
     {
         options.Description = value;
         return options;
     }
     if ("affinitygroup".Equals(key))
     {
         options.AffinityGroup = value;
         return options;
     }
     if ("georeplicationenabled".Equals(key))
     {
         bool result;
         if (!bool.TryParse(value, out result))
         {
             throw new ArgumentException("Tried to pass in a non-boolean value for this option. Please refactor manifest file.");
         }
         options.GeoReplicationEnabled = result;
         return options;
     }
     if ("location".Equals(key))
     {
         options.Location = value;
         return options;
     }
     if ("developerid".Equals(key))
     {
         options.DeveloperId = value;
         return options;
     }
     if ("developeralias".Equals(key))
     {
         options.DeveloperAlias = value;
         return options;
     }
     throw new ArgumentException(string.Format("The option provided '{0}' does not parse, please try your request again.", key));
 }