diff --git a/build.proj b/build.proj
index bfda35c81d8c..6dd3d0737bf8 100644
--- a/build.proj
+++ b/build.proj
@@ -215,6 +215,7 @@
+
: AzureDataCmdlet
where T : class
{
[Parameter(HelpMessage = "Azure Storage Context Object",
- ValueFromPipelineByPropertyName = true)]
+ ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
public virtual AzureStorageContext Context { get; set; }
[Parameter(HelpMessage = "The server time out for each request in seconds.")]
diff --git a/src/Common/Storage/Commands.Storage/File/AzureStorageFileCmdletBase.cs b/src/Common/Storage/Commands.Storage/File/AzureStorageFileCmdletBase.cs
index f38def2a9bf9..f332645077fa 100644
--- a/src/Common/Storage/Commands.Storage/File/AzureStorageFileCmdletBase.cs
+++ b/src/Common/Storage/Commands.Storage/File/AzureStorageFileCmdletBase.cs
@@ -23,14 +23,17 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File
public abstract class AzureStorageFileCmdletBase : StorageCloudCmdletBase
{
[Parameter(
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = Constants.ShareNameParameterSetName,
HelpMessage = "Azure Storage Context Object")]
[Parameter(
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = Constants.MatchingPrefixParameterSetName,
HelpMessage = "Azure Storage Context Object")]
[Parameter(
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = Constants.SpecificParameterSetName,
HelpMessage = "Azure Storage Context Object")]
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs
index d468cdccef29..04194ba13ae6 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs
@@ -33,6 +33,7 @@ public class GetAzureStorageShareStoredAccessPolicy : AzureStorageFileCmdletBase
[Parameter(Position = 0, Mandatory = true,
ParameterSetName = Constants.ShareNameParameterSetName,
HelpMessage = "Share name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string ShareName { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs
index 9a810fdd675b..ebf01bb8a6ae 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageDirectory.cs
@@ -50,6 +50,7 @@ public class NewAzureStorageDirectory : AzureStorageFileCmdletBase
[Parameter(
Position = 1,
Mandatory = true,
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Path of the directory to be created.")]
[ValidateNotNullOrEmpty]
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs
index b95965b23282..b5bf925035d1 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs
@@ -52,10 +52,12 @@ public class NewAzureStorageFileSasToken : AzureStorageFileCmdletBase
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Share Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = NameSasPermissionParameterSet)]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Share Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = NameSasPolicyParmeterSet)]
[ValidateNotNullOrEmpty]
@@ -63,10 +65,12 @@ public class NewAzureStorageFileSasToken : AzureStorageFileCmdletBase
[Parameter(Position = 1, Mandatory = true,
HelpMessage = "Path to the cloud file to generate sas token against.",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = NameSasPermissionParameterSet)]
[Parameter(Position = 1, Mandatory = true,
HelpMessage = "Path to the cloud file to generate sas token against.",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = NameSasPolicyParmeterSet)]
[ValidateNotNullOrEmpty]
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs
index 9bfe3a18167c..a48319ed1e8d 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShare.cs
@@ -22,6 +22,7 @@ public class NewAzureStorageShare : AzureStorageFileCmdletBase
[Parameter(
Position = 0,
Mandatory = true,
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Name of the file share to be created.")]
[ValidateNotNullOrEmpty]
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs
index af68a13af48c..28eaefaebc29 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs
@@ -39,6 +39,7 @@ public class NewAzureStorageShareSasToken : AzureStorageFileCmdletBase
[Alias("N", "Name")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Share Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string ShareName { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs
index e3d2582688cf..c2a35b2a1aa2 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs
@@ -31,6 +31,7 @@ public class NewAzureStorageShareStoredAccessPolicy : AzureStorageFileCmdletBase
[Parameter(Position = 0, Mandatory = true,
ParameterSetName = Constants.ShareNameParameterSetName,
HelpMessage = "Share name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string ShareName { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs
index 7046fdef6995..d6b625730442 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs
+++ b/src/Common/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,
ValueFromPipelineByPropertyName = true,
ParameterSetName = Constants.DirectoryParameterSetName,
HelpMessage = "Path to the directory to be removed.")]
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs
index 83b322a5e160..468a689839ce 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/RemoveAzureStorageShare.cs
@@ -29,6 +29,7 @@ public class RemoveAzureStorageShare : AzureStorageFileCmdletBase
[Parameter(
Position = 0,
Mandatory = true,
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = Constants.ShareNameParameterSetName,
HelpMessage = "Name of the file share to be removed.")]
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareQuota.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareQuota.cs
index 5e2a89b9002b..bc6237cd24f1 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareQuota.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareQuota.cs
@@ -32,6 +32,7 @@ public class SetAzureStorageShareQuota : AzureStorageFileCmdletBase
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Share name",
ParameterSetName = Constants.ShareNameParameterSetName,
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string ShareName { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs
index d74362d491e3..328d1663173d 100644
--- a/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs
@@ -32,6 +32,7 @@ public class SetAzureStorageShareStoredAccessPolicy : AzureStorageFileCmdletBase
[Parameter(Position = 0, Mandatory = true,
ParameterSetName = Constants.ShareNameParameterSetName,
HelpMessage = "Share name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string ShareName { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueue.cs b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueue.cs
index 152733276b35..4a5fe3269f10 100644
--- a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueue.cs
+++ b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueue.cs
@@ -43,6 +43,7 @@ public class GetAzureStorageQueueCommand : StorageQueueBaseCmdlet
[Alias("N", "Queue")]
[Parameter(Position = 0, HelpMessage = "Queue name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = NameParameterSet)]
public string Name { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueueStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueueStoredAccessPolicy.cs
index 4064a8099d77..0b0fa07defc1 100644
--- a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueueStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/GetAzureStorageQueueStoredAccessPolicy.cs
@@ -30,6 +30,7 @@ public class GetAzureStorageQueueStoredAccessPolicyCommand : StorageQueueBaseCmd
[Alias("N", "Name")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Queue Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Queue { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueue.cs b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueue.cs
index 92475ac713bd..e07da194c89e 100644
--- a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueue.cs
+++ b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueue.cs
@@ -28,7 +28,8 @@ public class NewAzureStorageQueueCommand : StorageQueueBaseCmdlet
{
[Alias("N", "Queue")]
[Parameter(Position = 0, Mandatory = true, HelpMessage = "Queue name",
- ValueFromPipelineByPropertyName = true)]
+ ValueFromPipeline = true,
+ ValueFromPipelineByPropertyName = true)]
public string Name { get; set; }
///
diff --git a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueSasToken.cs b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueSasToken.cs
index b8133f52c02c..c5f6f7252eb4 100644
--- a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueSasToken.cs
+++ b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueSasToken.cs
@@ -37,6 +37,7 @@ public class NewAzureStorageQueueSasTokenCommand : StorageQueueBaseCmdlet
[Alias("N", "Queue")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Table Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Name { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueStoredAccessPolicy.cs
index e1aa89feae15..6a22dd1fb16e 100644
--- a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/NewAzureStorageQueueStoredAccessPolicy.cs
@@ -29,6 +29,7 @@ public class NewAzureStorageQueueStoredAccessPolicyCommand : StorageQueueBaseCmd
[Alias("N", "Name")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Queue Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Queue { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/RemoveAzureStorageQueue.cs b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/RemoveAzureStorageQueue.cs
index 876726885bac..bc1f944cdec7 100644
--- a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/RemoveAzureStorageQueue.cs
+++ b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/RemoveAzureStorageQueue.cs
@@ -28,6 +28,7 @@ public class RemoveAzureStorageQueueCommand : StorageQueueBaseCmdlet
[Alias("N", "Queue")]
[Parameter(Position = 0, HelpMessage = "Queue name",
Mandatory = true,
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
public string Name { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/SetAzureStorageQueueStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/SetAzureStorageQueueStoredAccessPolicy.cs
index acdd570102eb..f58af93f227f 100644
--- a/src/Common/Storage/Commands.Storage/Queue/Cmdlet/SetAzureStorageQueueStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/Queue/Cmdlet/SetAzureStorageQueueStoredAccessPolicy.cs
@@ -29,6 +29,7 @@ public class SetAzureStorageQueueStoredAccessPolicyCommand : StorageQueueBaseCmd
[Alias("N", "Name")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Queue Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Queue { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetAzureStorageTableStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetAzureStorageTableStoredAccessPolicy.cs
index f1c03033fc04..ab810719841d 100644
--- a/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetAzureStorageTableStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetAzureStorageTableStoredAccessPolicy.cs
@@ -30,6 +30,7 @@ public class GetAzureStorageTableStoredAccessPolicyCommand : StorageCloudTableCm
[Alias("N", "Name")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Table Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Table { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetStorageAzureTable.cs b/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetStorageAzureTable.cs
index 6e0fe54ca607..c8eddb7248b0 100644
--- a/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetStorageAzureTable.cs
+++ b/src/Common/Storage/Commands.Storage/Table/Cmdlet/GetStorageAzureTable.cs
@@ -42,6 +42,7 @@ public class GetAzureStorageTableCommand : StorageCloudTableCmdletBase
[Alias("N", "Table")]
[Parameter(Position = 0, HelpMessage = "Table name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = NameParameterSet)]
public string Name { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableSasToken.cs b/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableSasToken.cs
index f946178f7d13..71abc0e60537 100644
--- a/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableSasToken.cs
+++ b/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableSasToken.cs
@@ -37,6 +37,7 @@ public class NewAzureStorageTableSasTokenCommand : StorageCloudTableCmdletBase
[Alias("N", "Table")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Table Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Name { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableStoredAccessPolicy.cs
index 801ec7d54f4b..7cc36c374e97 100644
--- a/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewAzureStorageTableStoredAccessPolicy.cs
@@ -29,6 +29,7 @@ public class NewAzureStorageTableStoredAccessPolicyCommand : StorageCloudTableCm
[Alias("N", "Name")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Table Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Table { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewStorageAzureTable.cs b/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewStorageAzureTable.cs
index 274daece3931..996cb9f3b3d8 100644
--- a/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewStorageAzureTable.cs
+++ b/src/Common/Storage/Commands.Storage/Table/Cmdlet/NewStorageAzureTable.cs
@@ -31,6 +31,7 @@ public class NewAzureStorageTableCommand : StorageCloudTableCmdletBase
{
[Alias("N", "Table")]
[Parameter(Position = 0, Mandatory = true, HelpMessage = "Table name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
public string Name { get; set; }
diff --git a/src/Common/Storage/Commands.Storage/Table/Cmdlet/RemoveStorageAzureTable.cs b/src/Common/Storage/Commands.Storage/Table/Cmdlet/RemoveStorageAzureTable.cs
index 44547348358b..daedc2486dfe 100644
--- a/src/Common/Storage/Commands.Storage/Table/Cmdlet/RemoveStorageAzureTable.cs
+++ b/src/Common/Storage/Commands.Storage/Table/Cmdlet/RemoveStorageAzureTable.cs
@@ -30,7 +30,8 @@ public class RemoveAzureStorageTableCommand : StorageCloudTableCmdletBase
{
[Alias("N", "Table")]
[Parameter(Position = 0, Mandatory = true, HelpMessage = "Table name",
- ValueFromPipelineByPropertyName = true)]
+ ValueFromPipeline = true,
+ ValueFromPipelineByPropertyName = true)]
public string Name { get; set; }
[Parameter(HelpMessage = "Force to remove the table without confirmation")]
diff --git a/src/Common/Storage/Commands.Storage/Table/Cmdlet/SetAzureStorageTableStoredAccessPolicy.cs b/src/Common/Storage/Commands.Storage/Table/Cmdlet/SetAzureStorageTableStoredAccessPolicy.cs
index 0e1b56509921..c4fd761f122a 100644
--- a/src/Common/Storage/Commands.Storage/Table/Cmdlet/SetAzureStorageTableStoredAccessPolicy.cs
+++ b/src/Common/Storage/Commands.Storage/Table/Cmdlet/SetAzureStorageTableStoredAccessPolicy.cs
@@ -29,6 +29,7 @@ public class SetAzureStorageTableStoredAccessPolicyCommand : StorageCloudTableCm
[Alias("N", "Name")]
[Parameter(Position = 0, Mandatory = true,
HelpMessage = "Table Name",
+ ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Table { get; set; }
diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchTestHelpers.cs b/src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchTestHelpers.cs
index ae97b2d4de8d..8fe09b5e06ff 100644
--- a/src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchTestHelpers.cs
+++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchTestHelpers.cs
@@ -31,6 +31,11 @@ namespace Microsoft.Azure.Commands.Batch.Test
///
public static class BatchTestHelpers
{
+ internal const string TestCertificateFileName1 = "Resources\\BatchTestCert01.cer";
+ internal const string TestCertificateFileName2 = "Resources\\BatchTestCert02.cer";
+ internal const string TestCertificateAlgorithm = "sha1";
+ internal const string TestCertificatePassword = "Passw0rd";
+
///
/// Builds an AccountResource object using the specified parameters
///
@@ -168,6 +173,44 @@ public static RequestInterceptor CreateFakGetFileAndPropertiesResponseIntercepto
return interceptor;
}
+ ///
+ /// Builds a CertificateGetResponse object
+ ///
+ public static ProxyModels.CertificateGetResponse CreateCertificateGetResponse(string thumbprint)
+ {
+ ProxyModels.CertificateGetResponse response = new ProxyModels.CertificateGetResponse();
+ response.StatusCode = HttpStatusCode.OK;
+
+ ProxyModels.Certificate cert = new ProxyModels.Certificate();
+ cert.Thumbprint = thumbprint;
+
+ response.Certificate = cert;
+
+ return response;
+ }
+
+ ///
+ /// Builds a CertificateListResponse object
+ ///
+ public static ProxyModels.CertificateListResponse CreateCertificateListResponse(IEnumerable certThumbprints)
+ {
+ ProxyModels.CertificateListResponse response = new ProxyModels.CertificateListResponse();
+ response.StatusCode = HttpStatusCode.OK;
+
+ List certs = new List();
+
+ foreach (string t in certThumbprints)
+ {
+ ProxyModels.Certificate cert = new ProxyModels.Certificate();
+ cert.Thumbprint = t;
+ certs.Add(cert);
+ }
+
+ response.Certificates = certs;
+
+ return response;
+ }
+
///
/// Builds a CloudPoolGetResponse object
///
diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/Certificates/GetBatchCertificateCommandTests.cs b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Certificates/GetBatchCertificateCommandTests.cs
new file mode 100644
index 000000000000..8c6e7c1f564e
--- /dev/null
+++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Certificates/GetBatchCertificateCommandTests.cs
@@ -0,0 +1,215 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using Microsoft.Azure.Batch;
+using Microsoft.Azure.Batch.Protocol;
+using Microsoft.Azure.Batch.Protocol.Models;
+using Microsoft.Azure.Commands.Batch.Models;
+using Microsoft.WindowsAzure.Commands.ScenarioTest;
+using Moq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Management.Automation;
+using System.Threading.Tasks;
+using Xunit;
+using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;
+
+namespace Microsoft.Azure.Commands.Batch.Test.Certificates
+{
+ public class GetBatchCertificateCommandTests : WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
+ {
+ private GetBatchCertificateCommand cmdlet;
+ private Mock batchClientMock;
+ private Mock commandRuntimeMock;
+
+ public GetBatchCertificateCommandTests()
+ {
+ batchClientMock = new Mock();
+ commandRuntimeMock = new Mock();
+ cmdlet = new GetBatchCertificateCommand()
+ {
+ CommandRuntime = commandRuntimeMock.Object,
+ BatchClient = batchClientMock.Object,
+ };
+ }
+
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void GetBatchCertificateTest()
+ {
+ // Setup cmdlet to get a cert by its thumbprint
+ BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
+ cmdlet.BatchContext = context;
+ cmdlet.ThumbprintAlgorithm = "sha1";
+ cmdlet.Thumbprint = "123456789";
+ cmdlet.Filter = null;
+
+ // Build a Certificate instead of querying the service on a Get Certificate call
+ CertificateGetResponse response = BatchTestHelpers.CreateCertificateGetResponse(cmdlet.Thumbprint);
+ RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor(response);
+ cmdlet.AdditionalBehaviors = new List() { interceptor };
+
+ // Setup the cmdlet to write pipeline output to a list that can be examined later
+ List pipeline = new List();
+ commandRuntimeMock.Setup(r => r.WriteObject(It.IsAny())).Callback