diff --git a/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs b/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs index afdc47e4df63..843b572dbc50 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using System; +using System.Globalization; using System.Management.Automation; using System.Security.Permissions; using Microsoft.WindowsAzure.Commands.Common; @@ -346,7 +347,14 @@ internal CloudStorageAccount GetStorageAccountWithAzureEnvironment(StorageCreden } else { - azureEnvironment = DefaultProfileClient.GetEnvironmentOrDefault(azureEnvironmentName); + try + { + azureEnvironment = DefaultProfileClient.GetEnvironmentOrDefault(azureEnvironmentName); + } + catch (ArgumentException e) + { + throw new ArgumentException(e.Message + " " + string.Format(CultureInfo.CurrentCulture, Resources.ValidEnvironmentName, EnvironmentName.AzureCloud, EnvironmentName.AzureChinaCloud)); + } } Uri blobEndPoint = azureEnvironment.GetStorageBlobEndpoint(storageAccountName, useHttps); diff --git a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs index 5c33be8d398f..2497168bddf5 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs @@ -50,6 +50,7 @@ public class NewAzureStorageDirectory : AzureStorageFileCmdletBase [Parameter( Position = 1, Mandatory = true, + ValueFromPipeline = true, HelpMessage = "Path of the directory to be created.")] [ValidateNotNullOrEmpty] public string Path { get; set; } diff --git a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs index 43b658ddd229..f932ee115ea5 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs @@ -22,6 +22,7 @@ public class NewAzureStorageShare : AzureStorageFileCmdletBase [Parameter( Position = 0, Mandatory = true, + ValueFromPipeline = true, HelpMessage = "Name of the file share to be created.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs index d3905c228c3e..0e56d2600e02 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs @@ -64,6 +64,7 @@ public class RemoveAzureStorageDirectory : AzureStorageFileCmdletBase HelpMessage = "Path to the directory to be removed.")] [Parameter( Position = 1, + ValueFromPipeline = true, ParameterSetName = Constants.DirectoryParameterSetName, HelpMessage = "Path to the directory to be removed.")] [ValidateNotNullOrEmpty] diff --git a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs index d9e46a61c4e7..eab3e00f0bb4 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs @@ -29,6 +29,7 @@ public class RemoveAzureStorageShare : AzureStorageFileCmdletBase [Parameter( Position = 0, Mandatory = true, + ValueFromPipeline = true, ParameterSetName = Constants.ShareNameParameterSetName, HelpMessage = "Name of the file share to be removed.")] [ValidateNotNullOrEmpty] diff --git a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageFileContent.cs b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageFileContent.cs index 1e992e04a0dc..545d610be675 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageFileContent.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageFileContent.cs @@ -52,9 +52,11 @@ public class SetAzureStorageFileContent : StorageFileDataManagementCmdletBase [ValidateNotNull] public CloudFileDirectory Directory { get; set; } + [Alias("FullName")] [Parameter( Position = 1, Mandatory = true, + ValueFromPipelineByPropertyName = true, HelpMessage = "Path to the local file to be uploaded.")] [ValidateNotNullOrEmpty] public string Source { get; set; } diff --git a/src/ServiceManagement/Storage/Commands.Storage/Microsoft.WindowsAzure.Commands.Storage.dll-Help.xml b/src/ServiceManagement/Storage/Commands.Storage/Microsoft.WindowsAzure.Commands.Storage.dll-Help.xml index 1d36c9737074..c57a26264ae2 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Microsoft.WindowsAzure.Commands.Storage.dll-Help.xml +++ b/src/ServiceManagement/Storage/Commands.Storage/Microsoft.WindowsAzure.Commands.Storage.dll-Help.xml @@ -2643,7 +2643,7 @@ echo "Total $total containers" - PS C:\> Get-AzureStorageFileContent -FileShareName sample -FilePath sampledir/samplefile + PS C:\> Get-AzureStorageFileContent -ShareName sample -FilePath sampledir/samplefile This example downloads the file whose path is sampledir/samplefile in the sample file share. @@ -3039,6 +3039,9 @@ echo "Total $total containers" + + http://msdn.microsoft.com/en-us/library/dn806375.aspx + @@ -3209,6 +3212,9 @@ echo "Total $total containers" + + http://msdn.microsoft.com/en-us/library/dn806390.aspx + @@ -4125,8 +4131,7 @@ New-AzureStorageBlobSASToken -Container cname -Blob bname -Permission rwd -Start - http://msdn.microsoft.com/en-us/library/windowsazure/dn140255.aspx - + http://msdn.microsoft.com/en-us/library/dn806412.aspx @@ -4649,8 +4654,7 @@ New-AzureStorageBlobSASToken -Container cname -Blob bname -Permission rwd -Start - http://msdn.microsoft.com/en-us/library/windowsazure/dn140255.aspx - + http://msdn.microsoft.com/en-us/library/dn806416.aspx @@ -4956,7 +4960,7 @@ New-AzureStorageBlobSASToken -Container cname -Blob bname -Permission rwd -Start String - + AzureCloud | AzureChinaCloud ConnectionString @@ -6041,8 +6045,7 @@ $context | Get-AzureStorageBlob -Container abc - http://msdn.microsoft.com/en-us/library/windowsazure/dn140255.aspx - + http://msdn.microsoft.com/en-us/library/dn806410.aspx @@ -6893,8 +6896,7 @@ $context | Get-AzureStorageBlob -Container abc - http://msdn.microsoft.com/en-us/library/windowsazure/dn140255.aspx - + http://msdn.microsoft.com/en-us/library/dn806400.aspx @@ -9482,7 +9484,7 @@ $context | Get-AzureStorageBlob -Container abc Name - + The name of the table to be removed. String @@ -9527,7 +9529,7 @@ $context | Get-AzureStorageBlob -Container abc Name - + The name of the table to be removed. String @@ -11368,6 +11370,9 @@ Set-AzureStorageBlobContent -File filename -Container containername -Metadata $m + + http://msdn.microsoft.com/en-us/library/dn806397.aspx + @@ -11614,6 +11619,9 @@ Set-AzureStorageBlobContent -File filename -Container containername -Metadata $m + + http://msdn.microsoft.com/en-us/library/dn806391.aspx + diff --git a/src/ServiceManagement/Storage/Commands.Storage/Resources.Designer.cs b/src/ServiceManagement/Storage/Commands.Storage/Resources.Designer.cs index 6b771c0a10a0..54664d9182dc 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Resources.Designer.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/Resources.Designer.cs @@ -1459,6 +1459,15 @@ internal static string UseStorageAccountFromContext { } } + /// + /// Looks up a localized string similar to Valid environment names are: '{0}' and '{1}'. + /// + internal static string ValidEnvironmentName { + get { + return ResourceManager.GetString("ValidEnvironmentName", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} {1}.. /// diff --git a/src/ServiceManagement/Storage/Commands.Storage/Resources.resx b/src/ServiceManagement/Storage/Commands.Storage/Resources.resx index 0e11042c4d4f..d7e24e14b87b 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Resources.resx +++ b/src/ServiceManagement/Storage/Commands.Storage/Resources.resx @@ -661,4 +661,8 @@ Failed: {2}. Transmit cancelled by user. + + Valid environment names are: '{0}' and '{1}' + 0 and 1 are for the correct Environment names + \ No newline at end of file