/// <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)) { rpError.Error error = (rpError.Error)Utilities.Deserialize <rpError.Error>(cloudException.Response.Content); if (error.ErrorCode.Equals(RpErrorCode.ResourceExtendedInfoNotFound.ToString(), StringComparison.InvariantCultureIgnoreCase)) { extendedInformation = new ResourceExtendedInformation(); } } } ResourceExtendedInfo extendedInfo = Utilities.Deserialize <ResourceExtendedInfo>(extendedInformation.ExtendedInfo); if (extendedInfo == null) { extendedInfo = this.CreateVaultExtendedInformation(); } else { if (!extendedInfo.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(extendedInfo.ChannelIntegrityKey); }