public override void ExecuteCmdlet() { if (!UseTrack2Sdk()) // Track1 { var sharedAccessPolicy = new SharedAccessAccountPolicy() { Permissions = SetupAccessPolicyPermission(this.Permission), Services = Service, ResourceTypes = ResourceType, Protocols = Protocol, IPAddressOrRange = Util.SetupIPAddressOrRangeForSAS(this.IPAddressOrRange) }; DateTimeOffset?accessStartTime; DateTimeOffset?accessEndTime; SasTokenHelper.SetupAccessPolicyLifeTime(StartTime, ExpiryTime, out accessStartTime, out accessEndTime, true); sharedAccessPolicy.SharedAccessStartTime = accessStartTime; sharedAccessPolicy.SharedAccessExpiryTime = accessEndTime; this.WriteObject(Channel.GetStorageAccountSASToken(sharedAccessPolicy)); } else { AccountSasBuilder sasBuilder = SasTokenHelper.SetAccountSasBuilder(this.Service, this.ResourceType, Permission, this.StartTime, this.ExpiryTime, this.IPAddressOrRange, this.Protocol); string sasToken = sasBuilder.ToSasQueryParameters(new StorageSharedKeyCredential(Channel.StorageContext.StorageAccountName, Channel.StorageContext.StorageAccount.Credentials.ExportBase64EncodedKey())).ToString(); if (sasToken[0] != '?') { sasToken = "?" + sasToken; } this.WriteObject(sasToken); } }