Skip to content

[Don't Merge!][SecureString] [SDK-based][Az.Storage] Remove the output type string #27193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: yanxu/ss/sdk/storage/outputtype1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### System.String

### System.Security.SecureString

## NOTES
Expand Down
26 changes: 6 additions & 20 deletions src/Storage/Storage/Blob/Cmdlet/NewAzureStorageBlobSasToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ namespace Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet
using global::Azure.Storage.Blobs;
using System.Collections.Generic;
using global::Azure.Storage;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using System.Security;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;

[CmdletOutputBreakingChangeWithVersion(typeof(String), "14.0.0", "9.0.0", ReplacementCmdletOutputTypeName = "System.Security.SecureString")]
[Cmdlet("New", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageBlobSASToken", DefaultParameterSetName = BlobNamePipelineParmeterSetWithPermission, SupportsShouldProcess = true), OutputType(typeof(String), typeof(SecureString))]
[Cmdlet("New", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageBlobSASToken", DefaultParameterSetName = BlobNamePipelineParmeterSetWithPermission, SupportsShouldProcess = true), OutputType(typeof(SecureString))]
public class NewAzureStorageBlobSasTokenCommand : StorageCloudBlobCmdletBase
{
/// <summary>
Expand Down Expand Up @@ -135,7 +134,8 @@ public string Policy
[ValidateNotNullOrEmpty]
public string EncryptionScope { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Specify to convert output token as a secure string.")]
[CmdletParameterBreakingChangeWithVersion("AsSecureString", "15.0.0", "10.0.0", ChangeDescription = "This parameter is drepacted. The output type is SecureString by default.")]
[Parameter(Mandatory = false, HelpMessage = "This parameter is drepacted. The output type is SecureString by default.")]
public SwitchParameter AsSecureString { get; set; }

// Overwrite the useless parameter
Expand Down Expand Up @@ -228,26 +228,12 @@ public override void ExecuteCmdlet()
if (FullUri)
{
string fullUri = SasTokenHelper.GetFullUriWithSASToken(blobClient.Uri.ToString(), sasToken);
if (AsSecureString)
{
WriteObject(fullUri.ConvertToSecureString());
}
else
{
WriteObject(fullUri);
}
WriteObject(fullUri.ConvertToSecureString());

}
else
{
if (AsSecureString)
{
WriteObject(sasToken.ConvertToSecureString());
}
else
{
WriteObject(sasToken);
}
WriteObject(sasToken.ConvertToSecureString());
}
}

Expand Down