/// <summary>
        /// Get the Integrity key
        /// </summary>
        /// <returns>key as string.</returns>
        private async Task<string> GetChannelIntegrityKey()
        {
            ResourceExtendedInformation extendedInformation = null;
            try
            {
                extendedInformation = await this.GetExtendedInfo();

            }
            catch (Exception exception)
            {
                CloudException cloudException = exception as CloudException;

                if (cloudException != null && cloudException.Response != null && !string.IsNullOrEmpty(cloudException.Response.Content))
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    rpError.Error error = serializer.Deserialize<rpError.Error>(cloudException.Response.Content);

                    if (error.ErrorCode.Equals(RpErrorCode.ResourceExtendedInfoNotFound.ToString(), StringComparison.InvariantCultureIgnoreCase))
                    {
                        extendedInformation = new ResourceExtendedInformation();
                    }
                }
            }

            if (null == extendedInformation.Properties)
            {
                extendedInformation = this.CreateVaultExtendedInformation();
            }
            else
            {
                if (!extendedInformation.Properties.Algorithm.Equals(CryptoAlgorithm.None.ToString(), StringComparison.InvariantCultureIgnoreCase))
                {
                    // In case this condition is true that means the credential was first generated in portal
                    // and hence can not be fetched here.
                    throw new CloudException(Resources.VaultSettingsGenerationUnSupported);
                }
            }

            return extendedInformation.Properties.IntegrityKey;
        }
        /// <summary>
        /// Method to create the extended info for the vault.
        /// </summary>
        /// <returns>returns the object as task</returns>
        private ResourceExtendedInformation CreateVaultExtendedInformation()
        {
            ResourceExtendedInformation extendedInformation =
                new ResourceExtendedInformation();
            extendedInformation.Properties = new ResourceExtendedInfoProperties();
            extendedInformation.Properties.IntegrityKey = Utilities.GenerateRandomKey(128);
            extendedInformation.Properties.Algorithm = CryptoAlgorithm.None.ToString();

            ResourceExtendedInformationArgs extendedInfoArgs = new ResourceExtendedInformationArgs();
            extendedInfoArgs.Properties = new ResourceExtendedInfoProperties();
            extendedInfoArgs.Properties.Algorithm = extendedInformation.Properties.Algorithm;
            extendedInfoArgs.Properties.IntegrityKey = extendedInformation.Properties.IntegrityKey;

            this.CreateExtendedInfo(extendedInfoArgs);

            return extendedInformation;
        }
        public void CreateAndRetrieveVaultExtendedInfo()
        {
            using (UndoContext context = UndoContext.Current)
            {
                context.Start();
                var rsmClient = GetRecoveryServicesClient(CustomHttpHandler);
                ResourceExtendedInformation extendedInformation =
                    new ResourceExtendedInformation();
                extendedInformation.Properties = new ResourceExtendedInfoProperties();
                extendedInformation.Properties.IntegrityKey = "integrity key";
                extendedInformation.Properties.Algorithm = "none";

                ResourceExtendedInformationArgs extendedInfoArgs = new ResourceExtendedInformationArgs();
                extendedInfoArgs.Properties = new ResourceExtendedInfoProperties();
                extendedInfoArgs.Properties.Algorithm = extendedInformation.Properties.Algorithm;
                extendedInfoArgs.Properties.IntegrityKey = extendedInformation.Properties.IntegrityKey;

                AzureOperationResponse response = rsmClient.VaultExtendedInfo.CreateExtendedInfo(resourceGroupName, resourceName, extendedInfoArgs, RequestHeaders);
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);

                ResourceExtendedInformationResponse extendedInfoResponse = rsmClient.VaultExtendedInfo.GetExtendedInfo(resourceGroupName, resourceName, RequestHeaders);
                Assert.NotNull(extendedInfoResponse.ResourceExtendedInformation.Properties.IntegrityKey);
                Assert.Equal(HttpStatusCode.OK, extendedInfoResponse.StatusCode);
            }
        }