Ejemplo n.º 1
0
            public async Task <bool> TryInitializeAsync(string id)
            {
                Console.WriteLine("Retrieving Resource: " + id);
                Resource = await ResourceController.GetResource(id);

                if (Resource == null)
                {
                    return(false);
                }

                if (string.IsNullOrEmpty(Resource.SubscriptionId))
                {
                    //need to create a VM
                    Console.WriteLine("Creating VM");
                    this.IsCreating = true;

                    Subscription = await ResourceController.GetAvailabeDeploymentSubscription();

                    ServiceName = await ResourceController.GetCloudServiceName(Resource);
                }
                else
                {
                    Console.WriteLine("Retrieving Subscription: " + Resource.SubscriptionId);
                    Subscription = await ResourceController.GetSubscription(Resource.SubscriptionId);

                    ServiceName = Resource.CloudServiceName;
                }


                Provisioning = new ProvisioningController(Subscription.AzureManagementThumbnail, Subscription.AzureSubscriptionID);
                return(true);
            }