private void GetHostedServiceProperties(String subscriptionId, String thumbprint, String serviceName)
        {
            String uri = String.Format(serviceOperationFormat, subscriptionId, serviceName);
            ServiceManagementOperation operation = new ServiceManagementOperation(thumbprint);
            XDocument hostedServiceProperties = operation.Invoke(uri);

            var deploymentInformation = (from t in hostedServiceProperties.Elements()
                            select new
                            {
                                DeploymentStatus = (
                                from deployments in t.Descendants(wa + "Deployments")
                                select deployments.Element(wa + "Deployment").Element(wa + "Status").Value).First(),
                                RoleCount = (
                                from roles in t.Descendants(wa + "RoleList")
                                select roles.Elements()).Count(),
                                InstanceCount = (
                                from instances in t.Descendants(wa + "RoleInstanceList")
                                select instances.Elements()).Count()

                            }).First();

            String deploymentStatus = deploymentInformation.DeploymentStatus;
            Int32 roleCount = deploymentInformation.RoleCount;
            Int32 instanceCount = deploymentInformation.InstanceCount;
        }
        private String UpgradeDeployment(String subscriptionId, String thumbprint, String serviceName, String deploymentSlot, String roleName, String packageUrl, String pathToConfigurationFile, String label )
        {
            String uri = String.Format(upgradeDeploymentFormat, subscriptionId, serviceName, deploymentSlot);

            XDocument payload = CreatePayload(roleName, packageUrl, pathToConfigurationFile, label);
            ServiceManagementOperation operation = new ServiceManagementOperation(thumbprint);
            String requestId = operation.Invoke(uri, payload);
            return requestId;
        }
        private String CreateHostedService(String subscriptionId, String thumbprint, String serviceName, String label, String description, String location, String affinityGroup)
        {
            String uri = String.Format(createHostedServiceFormat, subscriptionId);

            XDocument payload = CreatePayload(serviceName, label, description, location, affinityGroup);
            ServiceManagementOperation operation = new ServiceManagementOperation(thumbprint);
            String requestId = operation.Invoke(uri, payload);
            return requestId;
        }
        public String GetOperationStatus(String subscriptionId, String thumbprint, String requestId)
        {
            String uri = String.Format(getOperationStatusFormat, subscriptionId, requestId);
            ServiceManagementOperation operation = new ServiceManagementOperation(thumbprint);
            XDocument operationStatus = operation.Invoke(uri);

            String status = operationStatus.Element(wa + "Operation").Element(wa + "Status").Value;

            return status;
        }