diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi
index 98ef6a02cf1f..672cd10e5031 100644
--- a/setup/azurecmdfiles.wxi
+++ b/setup/azurecmdfiles.wxi
@@ -8,6 +8,9 @@
+
+
+
@@ -50,6 +53,15 @@
+
+
+
+
+
+
+
+
+
@@ -109,6 +121,9 @@
+
+
+
@@ -169,6 +184,15 @@
+
+
+
+
+
+
+
+
+
@@ -198,6 +222,9 @@
+
+
+
@@ -240,6 +267,15 @@
+
+
+
+
+
+
+
+
+
@@ -250,152 +286,176 @@
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -405,6 +465,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -528,6 +603,15 @@
+
+
+
+
+
+
+
+
+
@@ -560,6 +644,9 @@
+
+
+
@@ -620,6 +707,15 @@
+
+
+
+
+
+
+
+
+
@@ -640,6 +736,12 @@
+
+
+
+
+
+
@@ -700,6 +802,9 @@
+
+
+
@@ -714,6 +819,9 @@
+
+
+
@@ -771,6 +879,15 @@
+
+
+
+
+
+
+
+
+
@@ -785,6 +902,9 @@
+
+
+
@@ -853,6 +973,15 @@
+
+
+
+
+
+
+
+
+
@@ -937,6 +1066,15 @@
+
+
+
+
+
+
+
+
+
@@ -963,6 +1101,15 @@
+
+
+
+
+
+
+
+
+
@@ -1050,6 +1197,15 @@
+
+
+
+
+
+
+
+
+
@@ -1070,6 +1226,9 @@
+
+
+
@@ -1115,6 +1274,15 @@
+
+
+
+
+
+
+
+
+
@@ -1129,6 +1297,9 @@
+
+
+
@@ -1171,6 +1342,15 @@
+
+
+
+
+
+
+
+
+
@@ -1185,6 +1365,9 @@
+
+
+
@@ -1230,6 +1413,15 @@
+
+
+
+
+
+
+
+
+
@@ -1244,6 +1436,12 @@
+
+
+
+
+
+
@@ -1310,6 +1508,15 @@
+
+
+
+
+
+
+
+
+
@@ -1330,6 +1537,9 @@
+
+
+
@@ -1372,6 +1582,15 @@
+
+
+
+
+
+
+
+
+
@@ -1392,6 +1611,15 @@
+
+
+
+
+
+
+
+
+
@@ -1482,6 +1710,9 @@
+
+
+
@@ -1510,99 +1741,120 @@
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1680,6 +1932,9 @@
+
+
+
@@ -1722,9 +1977,15 @@
+
+
+
+
+
+
@@ -1739,6 +2000,12 @@
+
+
+
+
+
+
@@ -1792,6 +2059,9 @@
+
+
+
@@ -1837,11 +2107,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1893,6 +2175,15 @@
+
+
+
+
+
+
+
+
+
@@ -1953,6 +2244,15 @@
+
+
+
+
+
+
+
+
+
@@ -1976,6 +2276,9 @@
+
+
+
@@ -2018,6 +2321,15 @@
+
+
+
+
+
+
+
+
+
@@ -2125,6 +2437,15 @@
+
+
+
+
+
+
+
+
+
@@ -2283,6 +2604,15 @@
+
+
+
+
+
+
+
+
+
@@ -2363,6 +2693,15 @@
+
+
+
+
+
+
+
+
+
@@ -2467,6 +2806,15 @@
+
+
+
+
+
+
+
+
+
@@ -2607,6 +2955,9 @@
+
+
+
@@ -2966,6 +3317,15 @@
+
+
+
+
+
+
+
+
+
@@ -3039,6 +3399,15 @@
+
+
+
+
+
+
+
+
+
@@ -3137,6 +3506,15 @@
+
+
+
+
+
+
+
+
+
@@ -3463,6 +3841,9 @@
+
+
+
@@ -3505,6 +3886,15 @@
+
+
+
+
+
+
+
+
+
@@ -3654,6 +4044,15 @@
+
+
+
+
+
+
+
+
+
@@ -3731,6 +4130,15 @@
+
+
+
+
+
+
+
+
+
@@ -3772,6 +4180,7 @@
+
@@ -3786,6 +4195,9 @@
+
+
+
@@ -3805,6 +4217,7 @@
+
@@ -3825,6 +4238,9 @@
+
+
+
@@ -3834,6 +4250,7 @@
+
@@ -3848,59 +4265,75 @@
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3942,6 +4375,9 @@
+
+
+
@@ -3952,6 +4388,7 @@
+
@@ -3972,12 +4409,17 @@
+
+
+
+
+
@@ -3998,10 +4440,12 @@
+
+
@@ -4021,10 +4465,14 @@
+
+
+
+
@@ -4047,6 +4495,9 @@
+
+
+
@@ -4075,6 +4526,9 @@
+
+
+
@@ -4083,6 +4537,9 @@
+
+
+
@@ -4112,12 +4569,16 @@
+
+
+
+
@@ -4133,10 +4594,14 @@
+
+
+
+
@@ -4151,10 +4616,14 @@
+
+
+
+
@@ -4170,10 +4639,15 @@
+
+
+
+
+
@@ -4196,12 +4670,16 @@
+
+
+
+
@@ -4216,12 +4694,18 @@
+
+
+
+
+
+
@@ -4252,6 +4736,7 @@
+
@@ -4261,36 +4746,43 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4316,6 +4808,7 @@
+
@@ -4330,11 +4823,15 @@
+
+
+
+
@@ -4352,6 +4849,7 @@
+
@@ -4367,7 +4865,11 @@
+
+
+
+
@@ -4385,6 +4887,9 @@
+
+
+
@@ -4403,6 +4908,9 @@
+
+
+
@@ -4410,6 +4918,7 @@
+
@@ -4424,6 +4933,9 @@
+
+
+
@@ -4459,6 +4971,9 @@
+
+
+
@@ -4511,6 +5026,9 @@
+
+
+
@@ -4537,6 +5055,9 @@
+
+
+
@@ -4571,6 +5092,9 @@
+
+
+
@@ -4617,6 +5141,7 @@
+
@@ -4726,6 +5251,9 @@
+
+
+
@@ -4749,6 +5277,9 @@
+
+
+
@@ -4781,6 +5312,9 @@
+
+
+
@@ -4879,6 +5413,7 @@
+
@@ -4893,6 +5428,9 @@
+
+
+
@@ -4942,6 +5480,9 @@
+
+
+
@@ -4967,6 +5508,9 @@
+
+
+
diff --git a/src/Common/Storage/Azure.Storage.psd1 b/src/Common/Storage/Azure.Storage.psd1
index 27e92ce5e999..d8088f9b1a3f 100644
--- a/src/Common/Storage/Azure.Storage.psd1
+++ b/src/Common/Storage/Azure.Storage.psd1
@@ -55,17 +55,17 @@ ScriptsToProcess = @()
# Type files (.ps1xml) to be loaded when importing this module
TypesToProcess = @(
- '.\Microsoft.WindowsAzure.Commands.Storage.Types.ps1xml'
+ '.\Microsoft.WindowsAzure.Commands.Storage.Types.ps1xml'
)
# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @(
- '.\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml'
+ '.\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml'
)
# Modules to import as nested modules of the module specified in ModuleToProcess
NestedModules = @(
- '.\Microsoft.WindowsAzure.Commands.Storage.dll',
+ '.\Microsoft.WindowsAzure.Commands.Storage.dll'
)
# Functions to export from this module
@@ -79,7 +79,7 @@ VariablesToExport = '*'
# Aliases to export from this module
AliasesToExport = @(
- 'Get-AzureRMStorageContainerAcl',
+ 'Get-AzureRMStorageContainerAcl',
'Start-CopyAzureStorageBlob',
'Stop-CopyAzureStorageBlob'
)
diff --git a/src/ResourceManager/AzureBackup/AzureRM.AzureBackup.psd1 b/src/ResourceManager/AzureBackup/AzureRM.Backup.psd1
similarity index 100%
rename from src/ResourceManager/AzureBackup/AzureRM.AzureBackup.psd1
rename to src/ResourceManager/AzureBackup/AzureRM.Backup.psd1
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
index dd4ab033e045..34b48d313a86 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
@@ -19,7 +19,7 @@
true
full
false
- ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.AzureBackup\
+ ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Backup\
DEBUG;TRACE
prompt
4
@@ -30,7 +30,7 @@
MinimumRecommendedRules.ruleset
- ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.AzureBackup\
+ ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.Backup\
TRACE;SIGN
true
pdbonly
@@ -192,8 +192,8 @@
-
- AzureRM.AzureBackup.psd1
+
+ AzureRM.Backup.psd1
PreserveNewest
diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj
index 00f179186b58..2f77d199352c 100644
--- a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj
+++ b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj
@@ -19,7 +19,7 @@
true
full
false
- ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.AzureBatch\
+ ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Batch\
TRACE;DEBUG;CODE_ANALYSIS
prompt
4
@@ -30,7 +30,7 @@
pdbonly
true
- ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.AzureBatch\
+ ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.Batch\
TRACE;SIGN
prompt
4
diff --git a/src/ResourceManager/Compute/AzureRM.Compute.psd1 b/src/ResourceManager/Compute/AzureRM.Compute.psd1
index c47916898ce6..e09328b9938e 100644
--- a/src/ResourceManager/Compute/AzureRM.Compute.psd1
+++ b/src/ResourceManager/Compute/AzureRM.Compute.psd1
@@ -61,7 +61,8 @@ TypesToProcess = @(
# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @(
'.\Microsoft.Azure.Commands.Compute.format.ps1xml',
- '.\Microsoft.Azure.Commands.Compute.format.generated.ps1xml'
+ '.\Microsoft.Azure.Commands.Compute.format.generated.ps1xml',
+ '.\Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml',
)
# Modules to import as nested modules of the module specified in ModuleToProcess
diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1
index 6f9bf9b1001c..e7d04fd97100 100644
--- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1
+++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1
@@ -120,34 +120,66 @@ function Test-VirtualMachineScaleSet
$vmss.VirtualMachineProfile.StorageProfile.OSDisk.VirtualHardDiskContainers.Add($vhdContainer);
$st = New-AzureVirtualMachineScaleSet -ResourceGroupName $rgname -VirtualMachineScaleSetCreateOrUpdateParameters $vmss;
+
+ Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSet');
$vmssResult = Get-AzureVirtualMachineScaleSet -ResourceGroupName $rgname -VMScaleSetName $vmss.Name;
Assert-True { $vmss.Name -eq $vmssResult.VirtualMachineScaleSet.Name };
+ $output = $vmssResult | Out-String;
+ Assert-True { $output.Contains("VirtualMachineScaleSet") };
+ Write-Verbose ($output);
# List All
+ Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetAllList');
$vmssList = Get-AzureVirtualMachineScaleSetAllList -VirtualMachineScaleSetListAllParameters $null;
Assert-True { ($vmssList.VirtualMachineScaleSets | select -ExpandProperty Name) -contains $vmss.Name };
+ $output = $vmssList | Out-String;
+ Assert-True { $output.Contains("VirtualMachineScaleSets") };
+ Write-Verbose ($output);
# List from RG
+ Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetList');
$vmssList = Get-AzureVirtualMachineScaleSetList -ResourceGroupName $rgname;
Assert-True { ($vmssList.VirtualMachineScaleSets | select -ExpandProperty Name) -contains $vmss.Name };
+ $output = $vmssList | Out-String;
+ Assert-True { $output.Contains("VirtualMachineScaleSets") };
+ Write-Verbose ($output);
# List Skus
+ Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetSkusList');
$skuList = Get-AzureVirtualMachineScaleSetSkusList -ResourceGroupName $rgname -VMScaleSetName $vmss.Name;
+ $output = $skuList | Out-String;
+ Assert-True { $output.Contains("VirtualMachineScaleSetSku") };
+ Write-Verbose ($output);
# List All VMs
$vmListParams = New-AzureComputeParameterObject -FriendlyName VirtualMachineScaleSetVMListParameters;
$vmListParams.ResourceGroupName = $rgname;
$vmListParams.VirtualMachineScaleSetName = $vmss.Name;
+
+ Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetVMList');
$vmListResult = Get-AzureVirtualMachineScaleSetVMList -VirtualMachineScaleSetVMListParameters $vmListParams;
+ $output = $vmListResult | Out-String;
+ Assert-True { $output.Contains("VirtualMachineScaleSetVM") };
+ Write-Verbose ($output);
+
$vmList = $vmListResult.VirtualMachineScaleSetVMs;
# List each VM
for ($i = 0; $i -lt $vmList.Count; $i++)
{
+ Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetVM');
$vm = Get-AzureVirtualMachineScaleSetVM -ResourceGroupName $rgname -VMScaleSetName $vmss.Name -InstanceId $i;
Assert-NotNull $vm.VirtualMachineScaleSetVM;
+ $output = $vm | Out-String;
+ Assert-True { $output.Contains("VirtualMachineScaleSetVM") };
+ Write-Verbose ($output);
+
+ Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetVMInstanceView');
$vmInstance = Get-AzureVirtualMachineScaleSetVMInstanceView -ResourceGroupName $rgname -VMScaleSetName $vmss.Name -InstanceId $i;
Assert-NotNull $vmInstance.VirtualMachineScaleSetVMInstanceView;
+ $output = $vmInstance | Out-String;
+ Assert-True { $output.Contains("VirtualMachineScaleSetVMInstanceView") };
+ Write-Verbose($output);
}
# List Next (negative test)
diff --git a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj
index 0360177df7a5..5b3517ce2792 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj
+++ b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj
@@ -293,12 +293,15 @@
+
+
+
@@ -376,6 +379,9 @@
AzureRM.Compute.psd1
PreserveNewest
+
+ Always
+
Always
diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs b/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs
index 2f5eabcae1dc..078d8629c9d4 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs
@@ -47,6 +47,7 @@ public static class ValidateSetValues
{
public const string ReadOnly = "ReadOnly";
public const string ReadWrite = "ReadWrite";
+ public const string None = "None";
}
public static class ProfileNouns
diff --git a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml
new file mode 100644
index 000000000000..b8dd744e83f2
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml
@@ -0,0 +1,299 @@
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.DeleteOperationResponse
+
+ Microsoft.Azure.Management.Compute.Models.DeleteOperationResponse
+
+
+
+
+
+
+
+ EndTime
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_.Error, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+ StartTime
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_.Status, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+ TrackingOperationId
+
+
+
+ AzureAsyncOperation
+
+
+
+ RequestId
+
+
+
+ StatusCode
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetGetResponse
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetGetResponse
+
+
+
+
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_.VirtualMachineScaleSet, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+ RequestId
+
+
+
+ StatusCode
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListResponse
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListResponse
+
+
+
+
+
+
+
+ NextLink
+
+
+
+ if ($_.VirtualMachineScaleSets -eq $null) { 0 } else { $_.VirtualMachineScaleSets.Count }
+
+
+
+ foreach ($item in $_.VirtualMachineScaleSets) { [Newtonsoft.Json.JsonConvert]::SerializeObject($item, [Newtonsoft.Json.Formatting]::Indented) }
+
+
+
+ RequestId
+
+
+
+ StatusCode
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSet
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSet
+
+
+
+
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListSkusResponse
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListSkusResponse
+
+
+
+
+
+
+
+ if ($_.VirtualMachineScaleSetAvailableSkus -eq $null) { 0 } else { $_.VirtualMachineScaleSetAvailableSkus.Count }
+
+
+
+ foreach ($item in $_.VirtualMachineScaleSetAvailableSkus) { [Newtonsoft.Json.JsonConvert]::SerializeObject($item, [Newtonsoft.Json.Formatting]::Indented) }
+
+
+
+ RequestId
+
+
+
+ StatusCode
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetSku
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetSku
+
+
+
+
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetResponse
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetResponse
+
+
+
+
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_.VirtualMachineScaleSetVM, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+ RequestId
+
+
+
+ StatusCode
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetInstanceViewResponse
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetInstanceViewResponse
+
+
+
+
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_.VirtualMachineScaleSetVMInstanceView, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+ RequestId
+
+
+
+ StatusCode
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMListResponse
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMListResponse
+
+
+
+
+
+
+
+ if ($_.VirtualMachineScaleSetVMs -eq $null) { 0 } else { $_.VirtualMachineScaleSetVMs.Count }
+
+
+
+ foreach ($item in $_.VirtualMachineScaleSetVMs) { [Newtonsoft.Json.JsonConvert]::SerializeObject($item, [Newtonsoft.Json.Formatting]::Indented) }
+
+
+
+ RequestId
+
+
+
+ StatusCode
+
+
+
+
+
+
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVM
+
+ Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVM
+
+
+
+
+
+
+
+ [Newtonsoft.Json.JsonConvert]::SerializeObject($_, [Newtonsoft.Json.Formatting]::Indented)
+
+
+
+
+
+
+
+
diff --git a/src/ResourceManager/Compute/Commands.Compute/Models/VhdDownloadContext.cs b/src/ResourceManager/Compute/Commands.Compute/Models/VhdDownloadContext.cs
new file mode 100644
index 000000000000..6b460684400e
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Models/VhdDownloadContext.cs
@@ -0,0 +1,25 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System;
+using System.IO;
+
+namespace Microsoft.Azure.Commands.Compute.Models
+{
+ public class VhdDownloadContext
+ {
+ public FileInfo LocalFilePath { get; set; }
+ public Uri Source { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Models/VhdDownloaderModel.cs b/src/ResourceManager/Compute/Commands.Compute/Models/VhdDownloaderModel.cs
new file mode 100644
index 000000000000..5ab1443c3087
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Models/VhdDownloaderModel.cs
@@ -0,0 +1,40 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.WindowsAzure.Commands.Sync;
+using Microsoft.WindowsAzure.Commands.Sync.Download;
+using System.IO;
+
+namespace Microsoft.Azure.Commands.Compute.Models
+{
+ public class VhdDownloaderModel
+ {
+ public static VhdDownloadContext Download(DownloaderParameters downloadParameters, ComputeClientBaseCmdlet cmdlet)
+ {
+ Program.SyncOutput = new PSSyncOutputEvents(cmdlet);
+
+ downloadParameters.ProgressDownloadComplete = Program.SyncOutput.ProgressDownloadComplete;
+ downloadParameters.ProgressDownloadStatus = Program.SyncOutput.ProgressDownloadStatus;
+
+ var downloader = new Downloader(downloadParameters);
+ downloader.Download();
+
+ return new VhdDownloadContext
+ {
+ LocalFilePath = new FileInfo(downloadParameters.LocalFilePath),
+ Source = downloadParameters.BlobUri.Uri
+ };
+ }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs b/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs
index 77d355dc62c7..c01f610f2236 100644
--- a/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs
@@ -131,7 +131,7 @@ public UploadParameters ValidateParameters()
}
}
- var storageCredentialsFactory = CreateStorageCredentialsFactory(destinationUri);
+ var storageCredentialsFactory = CreateStorageCredentialsFactory();
PathIntrinsics currentPath = SessionState.Path;
var filePath = new FileInfo(currentPath.GetUnresolvedProviderPathFromPSPath(LocalFilePath.ToString()));
@@ -147,7 +147,7 @@ public UploadParameters ValidateParameters()
return parameters;
}
- private StorageCredentialsFactory CreateStorageCredentialsFactory(BlobUri destinationUri)
+ private StorageCredentialsFactory CreateStorageCredentialsFactory()
{
StorageCredentialsFactory storageCredentialsFactory;
diff --git a/src/ResourceManager/Compute/Commands.Compute/StorageServices/SaveAzureVhdCommand.cs b/src/ResourceManager/Compute/Commands.Compute/StorageServices/SaveAzureVhdCommand.cs
new file mode 100644
index 000000000000..87fd946dc2ea
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/StorageServices/SaveAzureVhdCommand.cs
@@ -0,0 +1,144 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Commands.Compute.Common;
+using Microsoft.Azure.Commands.Compute.Models;
+using Microsoft.Azure.Common.Authentication;
+using Microsoft.Azure.Common.Authentication.Models;
+using Microsoft.Azure.Management.Storage;
+using Microsoft.WindowsAzure.Commands.Sync.Download;
+using System;
+using System.IO;
+using System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.Compute.StorageServices
+{
+ [Cmdlet(VerbsData.Save, ProfileNouns.Vhd), OutputType(typeof(VhdDownloadContext))]
+ public class SaveAzureVhdCommand : ComputeClientBaseCmdlet
+ {
+ private const int DefaultNumberOfUploaderThreads = 8;
+ private const string ResourceGroupParameterSet = "ResourceGroupParameterSetName";
+ private const string StorageKeyParameterSet = "StorageKeyParameterSetName";
+
+ [Parameter(
+ Position = 0,
+ Mandatory = true,
+ ParameterSetName = ResourceGroupParameterSet,
+ ValueFromPipelineByPropertyName = true)]
+ [ValidateNotNullOrEmpty]
+ public string ResourceGroupName { get; set; }
+
+ [Parameter(
+ Position = 0,
+ Mandatory = true,
+ ParameterSetName = StorageKeyParameterSet,
+ HelpMessage = "Key of the storage account")]
+ [ValidateNotNullOrEmpty]
+ [Alias("sk")]
+ public string StorageKey
+ {
+ get;
+ set;
+ }
+
+ [Parameter(
+ Position = 1,
+ Mandatory = true,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Uri to blob")]
+ [ValidateNotNullOrEmpty]
+ [Alias("src")]
+ public Uri Source
+ {
+ get;
+ set;
+ }
+
+ [Parameter(
+ Position = 2,
+ Mandatory = true,
+ HelpMessage = "Local path of the vhd file")]
+ [ValidateNotNullOrEmpty]
+ [Alias("lf")]
+ public FileInfo LocalFilePath
+ {
+ get;
+ set;
+ }
+
+ private int numberOfThreads = DefaultNumberOfUploaderThreads;
+
+ [Parameter(
+ Position = 3,
+ Mandatory = false,
+ HelpMessage = "Number of downloader threads")]
+ [ValidateNotNullOrEmpty]
+ [ValidateRange(1, 64)]
+ [Alias("th")]
+ public int NumberOfThreads
+ {
+ get { return this.numberOfThreads; }
+ set { this.numberOfThreads = value; }
+ }
+
+ [Parameter(
+ Position = 4,
+ Mandatory = false,
+ HelpMessage = "Delete the local file if already exists")]
+ [ValidateNotNullOrEmpty]
+ [Alias("o")]
+ public SwitchParameter OverWrite
+ {
+ get;
+ set;
+ }
+
+ protected override void ProcessRecord()
+ {
+ BlobUri blobUri;
+ if (!BlobUri.TryParseUri(Source, out blobUri))
+ {
+ throw new ArgumentOutOfRangeException("Source", Source.ToString());
+ }
+
+ var storageKey = this.StorageKey;
+ if (this.StorageKey == null)
+ {
+ var storageClient = AzureSession.ClientFactory.CreateClient(
+ DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager);
+
+
+ var storageService = storageClient.StorageAccounts.GetProperties(this.ResourceGroupName, blobUri.StorageAccountName);
+ if (storageService != null)
+ {
+ var storageKeys = storageClient.StorageAccounts.ListKeys(this.ResourceGroupName, storageService.StorageAccount.Name);
+ storageKey = storageKeys.StorageAccountKeys.Key1;
+ }
+ }
+
+ var downloaderParameters = new DownloaderParameters
+ {
+ BlobUri = blobUri,
+ LocalFilePath = LocalFilePath.FullName,
+ ConnectionLimit = NumberOfThreads,
+ StorageAccountKey = storageKey,
+ ValidateFreeDiskSpace = true,
+ OverWrite = OverWrite
+ };
+
+ var vhdDownloadContext = VhdDownloaderModel.Download(downloaderParameters, this);
+ WriteObject(vhdDownloadContext);
+ }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs
index 5737db843271..59d83e64c760 100644
--- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs
@@ -60,7 +60,7 @@ public class AddAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMDataDiskCaching)]
[ValidateNotNullOrEmpty]
- [ValidateSet(ValidateSetValues.ReadOnly, ValidateSetValues.ReadWrite)]
+ [ValidateSet(ValidateSetValues.ReadOnly, ValidateSetValues.ReadWrite, ValidateSetValues.None)]
public string Caching { get; set; }
[Parameter(
diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMDataDiskCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMDataDiskCommand.cs
index 0b330cc5dc4d..83403242bd2a 100644
--- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMDataDiskCommand.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMDataDiskCommand.cs
@@ -68,7 +68,7 @@ public class SetAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMDataDiskCaching)]
[ValidateNotNullOrEmpty]
- [ValidateSet(ValidateSetValues.ReadOnly, ValidateSetValues.ReadWrite)]
+ [ValidateSet(ValidateSetValues.ReadOnly, ValidateSetValues.ReadWrite, ValidateSetValues.None)]
public string Caching { get; set; }
[Parameter(
diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMOSDiskCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMOSDiskCommand.cs
index 1226f5500a93..b29fd2277b6b 100644
--- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMOSDiskCommand.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMOSDiskCommand.cs
@@ -65,7 +65,7 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMOSDiskCaching)]
[ValidateNotNullOrEmpty]
- [ValidateSet(ValidateSetValues.ReadOnly, ValidateSetValues.ReadWrite)]
+ [ValidateSet(ValidateSetValues.ReadOnly, ValidateSetValues.ReadWrite, ValidateSetValues.None)]
public string Caching { get; set; }
[Alias("SourceImage")]
diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs
index 59f4bffb3244..310a285af452 100644
--- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs
@@ -12,9 +12,9 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
+using AutoMapper;
using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.Azure.Commands.Compute.Models;
-using Microsoft.Azure.Commands.Tags.Model;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System.Collections;
@@ -23,6 +23,7 @@
namespace Microsoft.Azure.Commands.Compute
{
[Cmdlet(VerbsCommon.New, ProfileNouns.VirtualMachine)]
+ [OutputType(typeof(PSComputeLongRunningOperation))]
public class NewAzureVMCommand : VirtualMachineBaseCmdlet
{
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true)]
@@ -61,7 +62,8 @@ protected override void ProcessRecord()
};
var op = this.VirtualMachineClient.CreateOrUpdate(this.ResourceGroupName, parameters);
- WriteObject(op);
+ var result = Mapper.Map(op);
+ WriteObject(result);
});
}
}
diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs
index 7f2f5bfe3f9e..51c184741750 100644
--- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs
@@ -12,7 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
-
+using AutoMapper;
using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.Azure.Commands.Compute.Models;
using Microsoft.Azure.Management.Compute;
@@ -22,7 +22,8 @@
namespace Microsoft.Azure.Commands.Compute
{
- [Cmdlet(VerbsData.Update, ProfileNouns.VirtualMachine, DefaultParameterSetName = ResourceGroupNameParameterSet)]
+ [Cmdlet(VerbsData.Update, ProfileNouns.VirtualMachine, DefaultParameterSetName = ResourceGroupNameParameterSet)]
+ [OutputType(typeof(PSComputeLongRunningOperation))]
public class UpdateAzureVMCommand : VirtualMachineActionBaseCmdlet
{
[Alias("VMProfile")]
@@ -53,7 +54,8 @@ protected override void ProcessRecord()
};
var op = this.VirtualMachineClient.CreateOrUpdate(this.ResourceGroupName, parameters);
- WriteObject(op);
+ var result = Mapper.Map(op);
+ WriteObject(result);
});
}
}
diff --git a/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1 b/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1
index 88631a18c9cd..3c7ed013faf3 100644
--- a/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1
+++ b/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1
@@ -58,7 +58,7 @@ TypesToProcess = @()
# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @(
- '.\Microsoft.Azure.Commands.OperationalInsights.format.ps1xml'
+ '.\Microsoft.Azure.Commands.OperationalInsights.format.ps1xml'
)
# Modules to import as nested modules of the module specified in ModuleToProcess
diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj
index 9086ec747cdc..69dabcffb636 100644
--- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj
+++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj
@@ -164,6 +164,7 @@
AzureRM.OperationalInsights.psd1
+ PreserveNewest
diff --git a/src/ResourceManager/Resources/AzureRM.Resources.psd1 b/src/ResourceManager/Resources/AzureRM.Resources.psd1
index 823fb009342b..54d68824b41b 100644
--- a/src/ResourceManager/Resources/AzureRM.Resources.psd1
+++ b/src/ResourceManager/Resources/AzureRM.Resources.psd1
@@ -64,7 +64,7 @@ FormatsToProcess = @(
# Modules to import as nested modules of the module specified in ModuleToProcess
NestedModules = @(
'.\Microsoft.Azure.Commands.Resources.dll',
- '.\Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll',
+ '.\Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll'
)
# Functions to export from this module
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs
index 6a8396fe7a2a..b636eaa36979 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs
@@ -103,13 +103,6 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase
[ValidateNotNullOrEmpty]
public string ResourceType { get; set; }
- ///
- /// Gets or sets the deprecated parent resource parameter.
- ///
- [Parameter(ParameterSetName = GetAzureResourceCmdlet.GetResourceParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The parent resource type. e.g. Servers/myServer.")]
- [ValidateNotNullOrEmpty]
- public string ParentResource { get; set; }
-
///
/// Gets or sets the extension resource name parameter.
///
@@ -132,34 +125,12 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase
[ValidateNotNullOrEmpty]
public string ExtensionResourceType { get; set; }
- ///
- /// Gets or sets the tag name.
- ///
- [Parameter(ParameterSetName = GetAzureResourceCmdlet.ListResourcesParameterSet, Mandatory = false, HelpMessage = "The name of the tag to query by.")]
- [Parameter(ParameterSetName = GetAzureResourceCmdlet.MultiSubscriptionListResourcesParameterSet, Mandatory = false, HelpMessage = "The name of the tag to query by.")]
- [ValidateNotNullOrEmpty]
- public string TagName { get; set; }
-
- ///
- /// Gets or sets the tag value.
- ///
- [Parameter(ParameterSetName = GetAzureResourceCmdlet.ListResourcesParameterSet, Mandatory = false, HelpMessage = "The value of the tag to query by.")]
- [Parameter(ParameterSetName = GetAzureResourceCmdlet.MultiSubscriptionListResourcesParameterSet, Mandatory = false, HelpMessage = "The value of the tag to query by.")]
- [ValidateNotNullOrEmpty]
- public string TagValue { get; set; }
-
///
/// Gets or sets the expand properties property.
///
[Parameter(Mandatory = false, HelpMessage = "When specified, expands the properties of the resource.")]
public SwitchParameter ExpandProperties { get; set; }
- ///
- /// Gets or sets the expand permissions property.
- ///
- [Parameter(Mandatory = false, HelpMessage = "When specified, expands the permissions on the resource.")]
- public SwitchParameter ExpandPermissions { get; set; }
-
///
/// Gets or sets the is collection.
///
@@ -186,15 +157,6 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase
[ValidateNotNullOrEmpty]
public string ODataQuery { get; set; }
- ///
- /// Gets or sets the subscription ids.
- ///
- [Parameter(Mandatory = false, ParameterSetName = GetAzureResourceCmdlet.GetResourceParameterSet, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscription to use.")]
- [Parameter(Mandatory = false, ParameterSetName = GetAzureResourceCmdlet.ListResourcesParameterSet, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscription to use.")]
- [Parameter(Mandatory = true, ParameterSetName = GetAzureResourceCmdlet.MultiSubscriptionListResourcesParameterSet, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscription to use.")]
- [ValidateNotNullOrEmpty]
- public Guid[] SubscriptionId { get; set; }
-
///
/// Gets or sets the resource group name.
///
@@ -217,12 +179,21 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase
[Parameter(Mandatory = false, HelpMessage = "The output format of the resource properties.")]
public ResourceObjectFormat OutputObjectFormat { get; set; }
+ ///
+ /// Gets or sets the subscription id.
+ ///
+ public Guid SubscriptionId { get; set; }
+
///
/// Initializes a new instance of the class.
///
public GetAzureResourceCmdlet()
{
this.OutputObjectFormat = ResourceObjectFormat.Legacy;
+ if(string.IsNullOrEmpty(this.ResourceId))
+ {
+ this.SubscriptionId = DefaultContext.Subscription.Id;
+ }
}
///
@@ -231,19 +202,6 @@ public GetAzureResourceCmdlet()
protected override void OnProcessRecord()
{
base.OnProcessRecord();
- if(!string.IsNullOrEmpty(this.TagName) || !string.IsNullOrEmpty(this.TagValue))
- {
- this.WriteWarning("The TagName and TagValue parameters are obsolete and will be removed in future releases.");
- }
- if(!string.IsNullOrEmpty(this.ParentResource))
- {
- this.WriteWarning("The ParentResource parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.");
- }
- if (this.ExpandPermissions.IsPresent)
- {
- this.WriteWarning("The ExpandPermissions parameter is obsolete and will be removed in future releases.");
- }
- this.subscriptionIds.AddRange(this.SubscriptionId.CoalesceEnumerable());
}
///
@@ -253,12 +211,6 @@ protected override void OnEndProcessing()
{
base.OnEndProcessing();
- this.SubscriptionId = this.subscriptionIds.DistinctArray();
- if (string.IsNullOrWhiteSpace(this.ResourceId) && !this.SubscriptionId.CoalesceEnumerable().Any() && !this.TenantLevel)
- {
- this.SubscriptionId = DefaultContext.Subscription.Id.AsArray();
- }
-
this.RunCmdlet();
}
@@ -292,10 +244,6 @@ private void RunCmdlet()
}
var powerShellObjects = items.SelectArray(genericResource => genericResource.ToPsObject(this.OutputObjectFormat));
- if (this.ExpandPermissions)
- {
- this.PopulatePermissions(powerShellObjects).Wait();
- }
this.WriteObject(sendToPipeline: powerShellObjects, enumerateCollection: true);
}
@@ -354,9 +302,7 @@ private async Task GetResource()
{
#pragma warning disable 618
- var resourceId = string.IsNullOrWhiteSpace(this.ParentResource)
- ? this.GetResourceId()
- : this.GetResourceIdWithParentResource();
+ var resourceId = this.GetResourceId();
#pragma warning restore 618
@@ -387,7 +333,7 @@ private async Task GetResource()
private async Task> ListResourcesTypeCollection()
{
var resourceCollectionId = ResourceIdUtility.GetResourceId(
- subscriptionId: this.SubscriptionId.CoalesceEnumerable().Cast().FirstOrDefault(),
+ subscriptionId: this.SubscriptionId,
resourceGroupName: this.ResourceGroupName,
resourceType: this.ResourceType,
resourceName: this.ResourceName,
@@ -401,8 +347,8 @@ private async Task> ListResourcesTypeCollect
var odataQuery = QueryFilterBuilder.CreateFilter(
resourceType: null,
resourceName: null,
- tagName: this.TagName,
- tagValue: this.TagValue,
+ tagName: null,
+ tagValue: null,
filter: this.ODataQuery);
return await this
@@ -422,12 +368,12 @@ private async Task> ListResourcesInTenant()
{
var filterQuery = QueryFilterBuilder
.CreateFilter(
- subscriptionIds: this.SubscriptionId,
+ subscriptionIds: new Guid[] { this.SubscriptionId },
resourceGroup: this.ResourceGroupName,
resourceType: this.ResourceType,
resourceName: this.ResourceName,
- tagName: this.TagName,
- tagValue: this.TagValue,
+ tagName: null,
+ tagValue: null,
filter: this.ODataQuery);
var apiVersion = await this
@@ -453,8 +399,8 @@ private async Task> ListResourcesInResourceG
.CreateFilter(
resourceType: this.ResourceType,
resourceName: this.ResourceName,
- tagName: this.TagName,
- tagValue: this.TagValue,
+ tagName: null,
+ tagValue: null,
filter: this.ODataQuery);
var apiVersion = await this
@@ -464,7 +410,7 @@ private async Task> ListResourcesInResourceG
return await this
.GetResourcesClient()
.ListResources(
- subscriptionId: this.SubscriptionId.Single(),
+ subscriptionId: this.SubscriptionId,
resourceGroupName: this.ResourceGroupName,
apiVersion: apiVersion,
top: this.Top,
@@ -482,8 +428,8 @@ private async Task> ListResourcesInSubscript
.CreateFilter(
resourceType: this.ResourceType,
resourceName: this.ResourceName,
- tagName: this.TagName,
- tagValue: this.TagValue,
+ tagName: null,
+ tagValue: null,
filter: this.ODataQuery);
var apiVersion = await this
@@ -493,7 +439,7 @@ private async Task> ListResourcesInSubscript
return await this
.GetResourcesClient()
.ListResources(
- subscriptionId: this.SubscriptionId.Single(),
+ subscriptionId: this.SubscriptionId,
apiVersion: apiVersion,
top: this.Top,
filter: filterQuery,
@@ -512,85 +458,6 @@ private Task> GetNextLink(string nextLi
.ListNextBatch(nextLink: nextLink, cancellationToken: this.CancellationToken.Value);
}
- ///
- /// Populates the permissions on an array of resources.
- ///
- /// The resources.
- private async Task PopulatePermissions(PSObject[] resources)
- {
- foreach (var batch in resources.Batch())
- {
- await batch
- .Select(resource => this.PopulatePermissions(resource: resource))
- .WhenAllForAwait()
- .ConfigureAwait(continueOnCapturedContext: false);
- }
- }
-
- ///
- /// Populates the permissions on the resource.
- ///
- /// The resource.
- private async Task PopulatePermissions(PSObject resource)
- {
- try
- {
- var resourceId = resource.Properties["ResourceId"].Value.ToString();
-
- var resourceCollectionId = resourceId + ResourceIdUtility
- .GetResourceCollectionId(
- subscriptionId: null,
- resourceGroupName: null,
- resourceType: null,
- extensionResourceType: "Microsoft.Authorization/permissions");
-
- var apiVersion = await ApiVersionHelper
- .DetermineApiVersion(
- DefaultContext,
- providerNamespace: "Microsoft.Authorization",
- resourceType: "permissions",
- cancellationToken: this.CancellationToken.Value,
- pre: this.Pre)
- .ConfigureAwait(continueOnCapturedContext: false);
-
- var permissions = PaginatedResponseHelper.Enumerate(
- getFirstPage: () => this.GetPermissions(permissionCheckId: resourceCollectionId, apiVersion: apiVersion),
- getNextPage: nextLink => this.GetNextLink(nextLink),
- cancellationToken: this.CancellationToken);
-
- resource.Properties.Add(new PSNoteProperty("Permissions", permissions));
- }
- catch (Exception ex)
- {
- if (ex.IsFatal())
- {
- throw;
- }
-
- ex = (ex is AggregateException)
- ? (ex as AggregateException).Flatten()
- : ex;
-
- this.errors.Add(new ErrorRecord(ex, "ErrorExpandingPermissions", ErrorCategory.CloseError, resource));
- }
- }
-
- ///
- /// Gets the permission.
- ///
- /// The permission check Id.
- /// The api version.
- ///
- private Task> GetPermissions(string permissionCheckId, string apiVersion)
- {
- return this
- .GetResourcesClient()
- .ListObjectColleciton(
- resourceCollectionId: permissionCheckId,
- apiVersion: apiVersion,
- cancellationToken: this.CancellationToken.Value);
- }
-
///
/// Populates the properties on an array of resources.
///
@@ -652,7 +519,7 @@ private string GetResourceId()
return !string.IsNullOrWhiteSpace(this.ResourceId)
? this.ResourceId
: ResourceIdUtility.GetResourceId(
- subscriptionId: this.SubscriptionId.CoalesceEnumerable().Cast().FirstOrDefault(),
+ subscriptionId: this.SubscriptionId,
resourceGroupName: this.ResourceGroupName,
resourceType: this.ResourceType,
resourceName: this.ResourceName,
@@ -660,28 +527,6 @@ private string GetResourceId()
extensionResourceName: this.ExtensionResourceName);
}
- ///
- /// Gets the resource Id using the ParentResource.
- ///
- private string GetResourceIdWithParentResource()
- {
- if (this.SubscriptionId.Length != 1)
- {
- throw new ArgumentException();
- }
-
-#pragma warning disable 618
-
- return ResourceIdUtility.GetResourceId(
- subscriptionId: this.SubscriptionId.First(),
- resourceGroupName: this.ResourceGroupName,
- parentResource: this.ParentResource,
- resourceType: this.ResourceType,
- resourceName: this.ResourceName);
-
-#pragma warning restore 618
- }
-
///
/// Returns true if this is a resource get at any level.
///
@@ -709,7 +554,7 @@ private bool IsResourceTypeCollectionGet()
///
private bool IsSubscriptionLevelResourceTypeCollectionGet()
{
- return this.SubscriptionId.Length == 1 &&
+ return this.SubscriptionId != Guid.Empty &&
this.ResourceGroupName == null &&
this.ResourceName == null &&
this.ExtensionResourceName == null &&
@@ -721,7 +566,7 @@ private bool IsSubscriptionLevelResourceTypeCollectionGet()
///
private bool IsResourceGroupLevelResourceTypeCollectionGet()
{
- return this.SubscriptionId.Length == 1 &&
+ return this.SubscriptionId != Guid.Empty &&
this.ResourceGroupName != null &&
this.ResourceName == null &&
this.ExtensionResourceName == null &&
@@ -734,7 +579,7 @@ private bool IsResourceGroupLevelResourceTypeCollectionGet()
///
private bool IsTenantLevelResourceTypeCollectionGet()
{
- return this.SubscriptionId.Length == 0 &&
+ return this.SubscriptionId == Guid.Empty &&
this.ResourceGroupName == null &&
this.ResourceName == null &&
this.ExtensionResourceName == null &&
@@ -747,10 +592,8 @@ private bool IsTenantLevelResourceTypeCollectionGet()
///
private bool IsSubscriptionLevelResourceGet()
{
- return this.SubscriptionId.Length == 1 &&
+ return this.SubscriptionId != Guid.Empty &&
this.ResourceGroupName == null &&
- this.TagName == null &&
- this.TagValue == null &&
(this.ResourceName != null || this.ExtensionResourceName != null) &&
(this.ResourceType != null || this.ExtensionResourceType != null);
}
@@ -761,10 +604,8 @@ private bool IsSubscriptionLevelResourceGet()
///
private bool IsResourceGroupLevelResourceGet()
{
- return this.SubscriptionId.Length == 1 &&
+ return this.SubscriptionId != Guid.Empty &&
this.ResourceGroupName != null &&
- this.TagName == null &&
- this.TagValue == null &&
(this.ResourceName != null || this.ExtensionResourceName != null) &&
(this.ResourceType != null || this.ExtensionResourceType != null);
}
@@ -774,10 +615,8 @@ private bool IsResourceGroupLevelResourceGet()
///
private bool IsTenantLevelResourceGet()
{
- return this.SubscriptionId.Length == 0 &&
+ return this.SubscriptionId == Guid.Empty &&
this.ResourceGroupName == null &&
- this.TagName == null &&
- this.TagValue == null &&
(this.ResourceName != null || this.ExtensionResourceName != null) &&
(this.ResourceType != null || this.ExtensionResourceType != null);
}
@@ -787,7 +626,7 @@ private bool IsTenantLevelResourceGet()
///
private bool IsSubscriptionLevelQuery()
{
- return this.SubscriptionId.Length == 1 &&
+ return this.SubscriptionId != Guid.Empty &&
this.ResourceGroupName == null;
}
@@ -796,11 +635,9 @@ private bool IsSubscriptionLevelQuery()
///
private bool IsResourceGroupLevelQuery()
{
- return this.SubscriptionId.Length == 1 &&
+ return this.SubscriptionId != Guid.Empty &&
this.ResourceGroupName != null &&
- (this.TagName != null ||
- this.TagValue != null ||
- this.ResourceName != null ||
+ (this.ResourceName != null ||
this.ExtensionResourceName != null ||
this.ResourceType != null ||
this.ExtensionResourceType != null);
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs
index 445e9d4a5158..9871a58adf67 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs
@@ -59,12 +59,6 @@ public class MoveAzureResourceCommand : ResourceManagerCmdletBase
[Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation.")]
public SwitchParameter Force { get; set; }
- ///
- /// Gets or sets a value that indicates if the operation should wait for completion before returning the result. If set, the cmdlet will return as soon as the request is accepted.
- ///
- [Parameter(Mandatory = false, HelpMessage = "Do not wait for operation to complete.")]
- public SwitchParameter NoWait { get; set; }
-
///
/// Gets or sets the ids of the resources to move.
///
@@ -101,10 +95,6 @@ protected override void OnEndProcessing()
///
private void RunCmdlet()
{
- if(this.NoWait.IsPresent)
- {
- this.WriteWarning("The NoWait parameter is obsolete and will be removed in future releases.");
- }
var resourceIdsToUse = this.resourceIds
.Concat(this.ResourceId)
.DistinctArray(StringComparer.InvariantCultureIgnoreCase);
@@ -161,28 +151,21 @@ private void RunCmdlet()
cancellationToken: this.CancellationToken.Value)
.Result;
- if(!this.NoWait)
- {
- var managementUri = this.GetResourcesClient()
- .GetResourceManagementRequestUri(
- resourceId: destinationResourceGroup,
- apiVersion: apiVersion,
- action: Constants.MoveResources);
+ var managementUri = this.GetResourcesClient()
+ .GetResourceManagementRequestUri(
+ resourceId: destinationResourceGroup,
+ apiVersion: apiVersion,
+ action: Constants.MoveResources);
- var activity = string.Format("POST {0}", managementUri.PathAndQuery);
+ var activity = string.Format("POST {0}", managementUri.PathAndQuery);
- var result = this
- .GetLongRunningOperationTracker(
- activityName: activity,
- isResourceCreateOrUpdate: false)
- .WaitOnOperation(operationResult: operationResult);
+ var result = this
+ .GetLongRunningOperationTracker(
+ activityName: activity,
+ isResourceCreateOrUpdate: false)
+ .WaitOnOperation(operationResult: operationResult);
- this.TryConvertAndWriteObject(result, ResourceObjectFormat.New);
- }
- else
- {
- this.WriteObject(operationResult);
- }
+ this.TryConvertAndWriteObject(result, ResourceObjectFormat.New);
});
}
}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs
index e0a72dc6bf71..7f84ad3b9e4c 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs
@@ -88,16 +88,6 @@ public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBa
[ValidateNotNullOrEmpty]
public string ResourceType { get; set; }
- ///
- /// Gets or sets the subscription id parameter.
- ///
- [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
- [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
- [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
- [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
- [ValidateNotNullOrEmpty]
- public Guid? SubscriptionId { get; set; }
-
///
/// Gets or sets the resource group name parameter.
///
@@ -119,22 +109,6 @@ public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBa
[ValidateNotNullOrEmpty]
public string LockId { get; set; }
- ///
- /// Initializes the default subscription id if needed.
- ///
- protected override void OnProcessRecord()
- {
- if (string.IsNullOrWhiteSpace(this.LockId) &&
- string.IsNullOrWhiteSpace(this.Scope) &&
- this.SubscriptionId == null &&
- !this.TenantLevel)
- {
- this.SubscriptionId = DefaultContext.Subscription.Id;
- }
-
- base.OnProcessRecord();
- }
-
///
/// Gets the resource Id from the supplied PowerShell parameters.
///
@@ -155,14 +129,14 @@ protected string GetResourceId(string lockName)
throw new InvalidOperationException(string.Format("The Id '{0}' does not belong to a lock.", this.LockId));
}
-
+
return !string.IsNullOrWhiteSpace(this.Scope)
? ResourceIdUtility.GetResourceId(
resourceId: this.Scope,
extensionResourceType: Constants.MicrosoftAuthorizationLocksType,
extensionResourceName: lockName)
: ResourceIdUtility.GetResourceId(
- subscriptionId: this.SubscriptionId,
+ subscriptionId: this.DefaultContext.Subscription.Id,
resourceGroupName: this.ResourceGroupName,
resourceType: this.ResourceType,
resourceName: this.ResourceName,
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs
index 97acf711f083..279b403c42af 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs
@@ -63,13 +63,6 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase
[ValidateNotNullOrEmpty]
public string ResourceType { get; set; }
- ///
- /// Gets or sets the deprecated parent resource parameter.
- ///
- [Parameter(ParameterSetName = ResourceManipulationCmdletBase.SubscriptionLevelResoruceParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The parent resource type. e.g. Servers/myServer.")]
- [ValidateNotNullOrEmpty]
- public string ParentResource { get; set; }
-
///
/// Gets or sets the extension resource name parameter.
///
@@ -93,13 +86,6 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase
[ValidateNotNullOrEmpty]
public string ODataQuery { get; set; }
- ///
- /// Gets or sets the subscription id parameter.
- ///
- [Parameter(ParameterSetName = ResourceManipulationCmdletBase.SubscriptionLevelResoruceParameterSet, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscription to use.")]
- [ValidateNotNullOrEmpty]
- public Guid? SubscriptionId { get; set; }
-
///
/// Gets or sets the resource group name parameter.
///
@@ -119,24 +105,24 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase
[Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation.")]
public SwitchParameter Force { get; set; }
+ ///
+ /// Gets or sets the subscription id.
+ ///
+ public Guid SubscriptionId { get; set; }
+
///
/// Initializes the default subscription id if needed.
///
- protected override void OnProcessRecord()
+ public ResourceManipulationCmdletBase()
{
- if(this.SubscriptionId != null)
- {
- this.WriteWarning("The SubscriptionId parameter is obsolete and will be removed in future releases.");
- }
- if (!string.IsNullOrEmpty(this.ParentResource))
- {
- this.WriteWarning("The ParentResource parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.");
- }
- if (string.IsNullOrWhiteSpace(this.ResourceId) && !this.TenantLevel && this.SubscriptionId == null)
+ if (string.IsNullOrEmpty(this.ResourceId))
{
this.SubscriptionId = DefaultContext.Subscription.Id;
}
+ }
+ protected override void OnProcessRecord()
+ {
base.OnProcessRecord();
}
@@ -149,9 +135,7 @@ protected string GetResourceId()
return !string.IsNullOrWhiteSpace(this.ResourceId)
? this.ResourceId
- : !this.TenantLevel || string.IsNullOrWhiteSpace(this.ParentResource)
- ? this.GetResourceIdWithoutParentResource()
- : this.GetResourceIdWithParentResource();
+ : this.GetResourceIdWithoutParentResource();
#pragma warning restore 618
}
@@ -169,22 +153,5 @@ private string GetResourceIdWithoutParentResource()
extensionResourceType: this.ExtensionResourceType,
extensionResourceName: this.ExtensionResourceName);
}
-
- ///
- /// Gets the resource Id using the ParentResource.
- ///
- private string GetResourceIdWithParentResource()
- {
-#pragma warning disable 618
-
- return ResourceIdUtility.GetResourceId(
- subscriptionId: this.SubscriptionId.Value,
- resourceGroupName: this.ResourceGroupName,
- parentResource: this.ParentResource,
- resourceType: this.ResourceType,
- resourceName: this.ResourceName);
-
-#pragma warning restore 618
- }
}
}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml
index b4d613db7b4e..c7de93f98193 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml
@@ -1396,13 +1396,6 @@
String
-
- SubscriptionId
-
-
-
- Nullable`1[Guid]
-
ResourceGroupName
@@ -1601,13 +1594,6 @@
String
-
- SubscriptionId
-
-
-
- Nullable`1[Guid]
-
ApiVersion
@@ -1660,13 +1646,6 @@
String
-
- SubscriptionId
-
-
-
- Nullable`1[Guid]
-
ResourceGroupName
@@ -3299,13 +3278,6 @@
String
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
ResourceGroupName
@@ -3494,13 +3466,6 @@
String
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
ApiVersion
@@ -3581,13 +3546,6 @@
String
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
ResourceGroupName
@@ -4631,13 +4589,6 @@
String
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
ResourceGroupName
@@ -6111,13 +6062,6 @@
String
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
ResourceGroupName
@@ -6306,13 +6250,6 @@
String
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
ApiVersion
@@ -6393,13 +6330,6 @@
String
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
ResourceGroupName
@@ -6627,18 +6557,6 @@
-
- SubscriptionId
-
- The subscription to use.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
-
-
ResourceGroupName
diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1
index b5e603879492..8ca227dcd7d3 100644
--- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1
+++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1
@@ -67,16 +67,17 @@ FormatsToProcess = @(
'.\AzureRM.Profile\Microsoft.Azure.Commands.Profile.format.ps1xml',
'.\AzureRM.DataFactories\Microsoft.Azure.Commands.DataFactories.format.ps1xml',
'.\AzureRM.RedisCache\Microsoft.Azure.Commands.RedisCache.format.ps1xml',
- '.\AzureRM.AzureBatch\Microsoft.Azure.Commands.Batch.format.ps1xml',
+ '.\AzureRM.Batch\Microsoft.Azure.Commands.Batch.format.ps1xml',
'.\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.format.ps1xml',
'.\AzureRM.StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml',
'.\AzureRM.Compute\Microsoft.Azure.Commands.Compute.format.ps1xml',
'.\AzureRM.Compute\Microsoft.Azure.Commands.Compute.format.generated.ps1xml',
+ '.\AzureRM.Compute\Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml',
'.\AzureRM.Network\Microsoft.Azure.Commands.Network.format.ps1xml',
'.\Azure.Storage\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml',
- '.\AzureRM.StorageManagement\Microsoft.Azure.Commands.Management.Storage.format.ps1xml',
+ '.\AzureRM.Storage\Microsoft.Azure.Commands.Management.Storage.format.ps1xml',
'.\AzureRM.OperationalInsights\Microsoft.Azure.Commands.OperationalInsights.format.ps1xml',
- '.\AzureRM.AzureBackup\Microsoft.Azure.Commands.AzureBackup.format.ps1xml',
+ '.\AzureRM.Backup\Microsoft.Azure.Commands.AzureBackup.format.ps1xml',
'.\AzureRM.UsageAggregates\Microsoft.Azure.Commands.UsageAggregates.Format.ps1xml',
'.\AzureRM.Sql\Microsoft.Azure.Commands.Sql.format.ps1xml'
)
@@ -91,7 +92,7 @@ NestedModules = @(
'.\AzureRM.Sql\Microsoft.Azure.Commands.Sql.dll',
'.\AzureRM.DataFactories\Microsoft.Azure.Commands.DataFactories.dll',
'.\AzureRM.RedisCache\Microsoft.Azure.Commands.RedisCache.dll',
- '.\AzureRM.AzureBatch\Microsoft.Azure.Commands.Batch.dll',
+ '.\AzureRM.Batch\Microsoft.Azure.Commands.Batch.dll',
'.\AzureRM.Dns\Microsoft.Azure.Commands.Dns.dll',
'.\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll',
'.\AzureRM.TrafficManager\Microsoft.Azure.Commands.TrafficManager.dll',
@@ -102,12 +103,12 @@ NestedModules = @(
'.\AzureRM.Network\Microsoft.Azure.Commands.Network.dll',
'.\Azure.Storage\Microsoft.WindowsAzure.Commands.Storage.dll',
'.\AzureRM.ApiManagement\Microsoft.Azure.Commands.ApiManagement.dll',
- '.\AzureRM.StorageManagement\Microsoft.Azure.Commands.Management.Storage.dll',
+ '.\AzureRM.Storage\Microsoft.Azure.Commands.Management.Storage.dll',
'.\AzureRM.OperationalInsights\Microsoft.Azure.Commands.OperationalInsights.dll',
'.\AzureRM.UsageAggregates\Microsoft.Azure.Commands.UsageAggregates.dll',
'.\AzureRM.HDInsight\Microsoft.Azure.Commands.HDInsight.dll',
'.\AzureRM.ApiManagement\Microsoft.Azure.Commands.ApiManagement.ServiceManagement.dll',
- '.\AzureRM.AzureBackup\Microsoft.Azure.Commands.AzureBackup.dll',
+ '.\AzureRM.Backup\Microsoft.Azure.Commands.AzureBackup.dll',
'.\AzureRM.SiteRecovery\Microsoft.Azure.Commands.SiteRecovery.dll'
)
diff --git a/src/ResourceManager/Storage/AzureRM.Storage.psd1 b/src/ResourceManager/Storage/AzureRM.Storage.psd1
index e50c9e9505b5..87be3fc8d155 100644
--- a/src/ResourceManager/Storage/AzureRM.Storage.psd1
+++ b/src/ResourceManager/Storage/AzureRM.Storage.psd1
@@ -46,8 +46,8 @@ ProcessorArchitecture = 'None'
# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(
- @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.8' },
- @{ ModuleName = 'Azure.Storage'; ModuleVersion = '0.9.8' }
+ @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.8' },
+ @{ ModuleName = 'Azure.Storage'; ModuleVersion = '0.9.8' }
)
# Assemblies that must be loaded prior to importing this module
@@ -61,7 +61,7 @@ TypesToProcess = @()
# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @(
- '.\Microsoft.Azure.Commands.Management.Storage.format.ps1xml',
+ '.\Microsoft.Azure.Commands.Management.Storage.format.ps1xml'
)
# Modules to import as nested modules of the module specified in ModuleToProcess
diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj
index 87df71b19da9..bb17d972b332 100644
--- a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj
+++ b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj
@@ -19,7 +19,7 @@
true
full
false
- ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.StorageManagement\
+ ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Storage\
DEBUG;TRACE
prompt
4
@@ -31,7 +31,7 @@
pdbonly
TRACE;SIGN
true
- ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.StorageManagement\
+ ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.Storage\
TRACE
bin\Release\Microsoft.Azure.Commands.Management.Storage.dll.CodeAnalysisLog.xml
true
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1 b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1
index c34b376ee7b1..e51cfbae9d02 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1
@@ -1754,6 +1754,157 @@ function Get-SubComplexParameterList
return Get-SubComplexParameterListFromType $param_info.ParameterType $client_name_space;
}
+# Get proper type name
+function Get-ProperTypeName
+{
+ param([System.Type] $itemType)
+
+ if ($itemType.IsGenericType -and ($itemType.Name.StartsWith('IList') -or $itemType.Name.StartsWith('List')))
+ {
+ $typeStr = 'IList<' + $itemType.GenericTypeArguments[0].Name + '>';
+ }
+ elseif ($itemType.IsGenericType -and ($itemType.Name.StartsWith('IDictionary') -or $itemType.Name.StartsWith('Dictionary')))
+ {
+ $typeStr = 'IDictionary<' + $itemType.GenericTypeArguments[0].Name + ',' + $itemType.GenericTypeArguments[1].Name + '>';
+ }
+ elseif ($itemType.IsGenericType -and $itemType.Name.StartsWith('Nullable'))
+ {
+ $typeStr = $itemType.GenericTypeArguments[0].Name + '?';
+ }
+ else
+ {
+ $typeStr = $itemType.Name;
+ }
+
+ $typeStr = $typeStr.Replace("System.String", "string");
+ $typeStr = $typeStr.Replace("String", "string");
+ $typeStr = $typeStr.Replace("System.Boolean", "bool");
+ $typeStr = $typeStr.Replace("Boolean", "bool");
+ $typeStr = $typeStr.Replace("System.UInt32", "uint");
+ $typeStr = $typeStr.Replace("UInt32", "uint");
+ $typeStr = $typeStr.Replace("System.Int32", "int");
+ $typeStr = $typeStr.Replace("Int32", "int");
+
+ return $typeStr;
+}
+
+
+# Process the list return type
+function Process-ListType
+{
+ param([Type] $rt, [System.String] $name)
+
+ $result = $null;
+
+ if ($rt -eq $null)
+ {
+ return $result;
+ }
+
+ $xml = '' + $rt.FullName + '';
+ $xml += '' + $rt.FullName + '' + [System.Environment]::NewLine;
+ $xml += '' + [System.Environment]::NewLine;
+
+ $itemLabel = $itemName = $rt.Name;
+ $xml += "[Newtonsoft.Json.JsonConvert]::SerializeObject(" + "$" + "_, [Newtonsoft.Json.Formatting]::Indented)" + [System.Environment]::NewLine;
+ $xml += '' + [System.Environment]::NewLine;
+ $xml = '' + [System.Environment]::NewLine + $xml + '' + [System.Environment]::NewLine;
+
+ Write-Verbose ("Xml: " + $xml);
+
+ return $xml;
+}
+
+# Process the return type
+function Process-ReturnType
+{
+ param([Type] $rt)
+
+ $result = $null;
+
+ if ($rt -eq $null)
+ {
+ return $result;
+ }
+
+
+ if ($rt.Name -like '*LongRunning*' -or $rt.Name -like '*computeoperationresponse*' -or $rt.Name -like '*AzureOperationResponse*')
+ {
+ return $result;
+ }
+
+ $xml = '' + $rt.FullName + '';
+ $xml += '' + $rt.FullName + '' + [System.Environment]::NewLine;
+ $xml += '' + [System.Environment]::NewLine;
+
+ $props = $rt.GetProperties([System.Reflection.BindingFlags]::Public -bor [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::Static);
+
+ foreach ($pr1 in $props)
+ {
+ $typeStr = Get-ProperTypeName $pr1.PropertyType;
+ $itemLabel = $itemName = $pr1.Name;
+
+ if ($typeStr -eq 'string' `
+ -or $typeStr -eq 'string[]' `
+ -or $typeStr -eq 'uint' `
+ -or $typeStr -eq 'uint?' `
+ -or $typeStr -eq 'int' `
+ -or $typeStr -eq 'int?' `
+ -or $typeStr -eq 'bool' `
+ -or $typeStr -eq 'bool?' `
+ -or $typeStr -eq 'DateTime' `
+ -or $typeStr -eq 'DateTime?' `
+ -or $typeStr -eq 'DateTimeOffset' `
+ -or $typeStr -eq 'DateTimeOffset?' `
+ -or $typeStr -eq 'HttpStatusCode' )
+ {
+ $xml += "${itemName}" + [System.Environment]::NewLine;
+ }
+ elseif ($typeStr.StartsWith('IList') `
+ -or $typeStr.StartsWith('IDictionary'))
+ {
+ $elementType = $pr1.PropertyType.GenericTypeArguments[0];
+
+ if (-not $elementType.FullName.Contains("String"))
+ {
+ $addxml = Process-ListType -rt $pr1.PropertyType.GenericTypeArguments[0] -name ${itemName};
+ }
+
+ $xml += " if (" + "$" + "_.${itemName} -eq $" + "null) { 0 } else { $" + "_.${itemName}.Count }" + [System.Environment]::NewLine;
+ $xml += " foreach ($" + "item in $" + "_.${itemName}) { [Newtonsoft.Json.JsonConvert]::SerializeObject(" + "$" + "item, [Newtonsoft.Json.Formatting]::Indented) } " + [System.Environment]::NewLine;
+ }
+ else
+ {
+ $xml += "[Newtonsoft.Json.JsonConvert]::SerializeObject(" + "$" + "_." + ${itemName} + ", [Newtonsoft.Json.Formatting]::Indented)" + [System.Environment]::NewLine;
+ }
+ }
+
+ $xml += '' + [System.Environment]::NewLine;
+ $xml = '' + [System.Environment]::NewLine + $xml + '' + [System.Environment]::NewLine;
+
+ if (-not [System.String]::IsNullOrEmpty($addxml))
+ {
+ $xml += $addxml;
+ }
+
+ Write-Verbose ("Xml: " + $xml);
+
+ return $xml;
+}
+
+# Get proper type name
+function Format-XML ([xml]$xml, $indent = 2)
+{
+ $StringWriter = New-Object System.IO.StringWriter;
+ $XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter;
+ $xmlWriter.Formatting = "indented";
+ $xmlWriter.Indentation = $Indent;
+ $xml.WriteContentTo($XmlWriter);
+ $XmlWriter.Flush();
+ $StringWriter.Flush();
+ Write-Output $StringWriter.ToString();
+}
+
# Sample: NewAzureVirtualMachineCreateParameters.cs
function Write-ParameterCmdletFile
{
@@ -1927,6 +2078,9 @@ else
$dynamic_param_method_code = @();
$invoke_cmdlet_method_code = @();
$parameter_cmdlet_method_code = @();
+ $all_return_type_names = @();
+ $formatXml = "";
+
$cli_command_method_code =
@"
/**
@@ -2025,6 +2179,18 @@ exports.init = function (cli) {
}
}
}
+
+ $rt = $mt.ReturnType.GenericTypeArguments[0];
+
+ if ($all_return_type_names.Contains($rt.Name))
+ {
+ Write-Verbose("Already Exists: " + $rt.Name);
+ }
+ else
+ {
+ $all_return_type_names += $rt.Name;
+ $formatXml += Process-ReturnType -rt $mt.ReturnType.GenericTypeArguments[0];
+ }
}
Write-InvokeCmdletFile $invoke_cmdlet_file_name $invoke_cmdlet_class_name $auto_base_cmdlet_name $clientClassType $filtered_types $invoke_cmdlet_method_code $dynamic_param_method_code;
@@ -2042,4 +2208,24 @@ exports.init = function (cli) {
Write-Output "=============================================";
Write-Output "Finished.";
Write-Output "=============================================";
+
+ $outFolder = $outFolder.Replace('/Generated', "");
+ $xmlFilePath = ($outFolder + '\' + $code_common_namespace + '.format.generated.ps1xml');
+
+ Write-Host ('Writing XML Format File: ' + $xmlFilePath);
+
+ $xmlCommentHeader = '' + [System.Environment]::NewLine;
+
+ $xmlContent = [xml]($xmlCommentHeader + '' + [System.Environment]::NewLine + $formatXml + '' + [System.Environment]::NewLine);
+ $node = $xmlContent.CreateXmlDeclaration('1.0', 'UTF-8', $null);
+ $xmlContent.InsertBefore($node, $xmlContent.ChildNodes[0]);
+
+ $formattedXmlContent = Format-XML $xmlContent.OuterXml;
+ Set-Content -Force -Path $xmlFilePath -Value $formattedXmlContent;
+ Write-Verbose($formattedXmlContent);
}
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/BVTTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/BVTTest.cs
index 520fc058609e..9e891962b837 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/BVTTest.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/BVTTest.cs
@@ -379,6 +379,9 @@ public void AzureIaaSBVT()
//
// Remove-AzureVM
//
+ vmPowershellCmdlets.RemoveAzureVM(newAzureVMName, serviceName, false, true);
+ Assert.AreNotEqual(null, vmPowershellCmdlets.GetAzureVM(newAzureVMName, serviceName));
+
vmPowershellCmdlets.RemoveAzureVM(newAzureVMName, serviceName);
RecordTimeTaken(ref prevTime);
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/CredentialHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/CredentialHelper.cs
index d7d2bcb8296b..c04882e8c968 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/CredentialHelper.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/CredentialHelper.cs
@@ -12,15 +12,17 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.Properties;
+using Microsoft.WindowsAzure.Commands.Storage.Common;
+using Microsoft.WindowsAzure.Storage.Auth;
+using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.Properties;
-using Microsoft.WindowsAzure.Storage.Auth;
-using Microsoft.WindowsAzure.Storage.Blob;
+using System.Management.Automation;
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests
{
@@ -263,12 +265,14 @@ public static void CopyTestData(string srcContainer, string srcBlob, string dest
// Create a container
try
{
- vmPowershellCmdlets.RunPSScript("Get-AzureStorageContainer -Name " + destContainer);
+ vmPowershellCmdlets.RunPSScript(String.Format("{0}-{1} -Name {2}",
+ VerbsCommon.Get, StorageNouns.Container, destContainer));
}
catch
{
// Create a container.
- vmPowershellCmdlets.RunPSScript("New-AzureStorageContainer -Name " + destContainer);
+ vmPowershellCmdlets.RunPSScript(String.Format("{0}-{1} -Name {2}",
+ VerbsCommon.New, StorageNouns.Container, destContainer));
}
// Make SAS Uri for the source blob.
@@ -276,12 +280,14 @@ public static void CopyTestData(string srcContainer, string srcBlob, string dest
if (string.IsNullOrEmpty(destBlob))
{
- vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcContainer {0} -SrcBlob {1} -DestContainer {2} -Force", srcContainer, srcBlob, destContainer));
+ vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcContainer {2} -SrcBlob {3} -DestContainer {4} -Force",
+ VerbsLifecycle.Start, StorageNouns.CopyBlob, srcContainer, srcBlob, destContainer));
destBlob = srcBlob;
}
else
{
- vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));
+ vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcUri \"{2}\" -DestContainer {3} -DestBlob {4} -Force",
+ VerbsLifecycle.Start, StorageNouns.CopyBlob, srcSasUri, destContainer, destBlob));
}
for (int i = 0; i < 60; i++)
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTestCommonVhd.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTestCommonVhd.cs
index f7c661787d10..9863677cd6f6 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTestCommonVhd.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTestCommonVhd.cs
@@ -12,14 +12,15 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
-
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
+using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
+using Microsoft.WindowsAzure.Commands.Storage.Common;
using System;
using System.IO;
using System.Linq;
+using System.Management.Automation;
using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
-using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests
{
@@ -166,7 +167,8 @@ public void AzureDiskTest()
private void CopyCommonVhd(string vhdContainerName, string vhdName, string myVhdName)
{
- vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcContainer {0} -SrcBlob {1} -DestContainer {2} -DestBlob {3}", vhdContainerName, vhdName, vhdContainerName, myVhdName));
+ vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcContainer {2} -SrcBlob {3} -DestContainer {4} -DestBlob {5}",
+ VerbsLifecycle.Start, StorageNouns.CopyBlob, vhdContainerName, vhdName, vhdContainerName, myVhdName));
}
[TestMethod(), TestCategory(Category.Functional), TestCategory(Category.BVT), TestProperty("Feature", "IAAS"), Priority(1), Owner("hylee"), Description("Test the cmdlet ((Add,Get,Save,Update,Remove)-AzureVMImage)")]
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/RemoveAzureVMCmdletInfo.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/RemoveAzureVMCmdletInfo.cs
index 8048c1ad0736..39632cbd2990 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/RemoveAzureVMCmdletInfo.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/RemoveAzureVMCmdletInfo.cs
@@ -19,7 +19,7 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests
{
public class RemoveAzureVMCmdletInfo : CmdletsInfo
{
- public RemoveAzureVMCmdletInfo(string vmName, string serviceName, bool deleteVhd)
+ public RemoveAzureVMCmdletInfo(string vmName, string serviceName, bool deleteVhd, bool whatif)
{
this.cmdletName = Utilities.RemoveAzureVMCmdletName;
this.cmdletParams.Add(new CmdletParam("Name", vmName));
@@ -29,6 +29,11 @@ public RemoveAzureVMCmdletInfo(string vmName, string serviceName, bool deleteVhd
{
this.cmdletParams.Add(new CmdletParam("DeleteVhd"));
}
+
+ if (whatif)
+ {
+ this.cmdletParams.Add(new CmdletParam("WhatIf"));
+ }
}
}
}
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs
index bddb03530864..affe8d845584 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs
@@ -33,6 +33,7 @@
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PIRCmdletInfo;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.NetworkCmdletInfo;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.SubscriptionCmdletInfo;
+using Microsoft.WindowsAzure.Commands.Storage.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Microsoft.WindowsAzure.Management.Network.Models;
using Microsoft.WindowsAzure.Storage.Blob;
@@ -176,7 +177,8 @@ private Collection RunPSCmdletAndReturnAllHelper(PowershellCore.CmdletsInf
public CopyState CheckCopyBlobStatus(string destContainer, string destBlob, bool debug = false)
{
List st = new List();
- st.Add(string.Format("Get-AzureStorageBlobCopyState -Container {0} -Blob {1}", destContainer, destBlob));
+ st.Add(string.Format("{0}-{1} -Container {2} -Blob {3}",
+ VerbsCommon.Get, StorageNouns.CopyBlobStatus, destContainer, destBlob));
WindowsAzurePowershellScript azurePowershellCmdlet = new WindowsAzurePowershellScript(st);
return (CopyState)azurePowershellCmdlet.Run(debug)[0].BaseObject;
@@ -1446,9 +1448,9 @@ public SM.PersistentVMRoleContext GetAzureVM(string vmName, string serviceName)
return RunPSCmdletAndReturnFirst(new GetAzureVMCmdletInfo(vmName, serviceName));
}
- public ManagementOperationContext RemoveAzureVM(string vmName, string serviceName, bool deleteVhd = false)
+ public ManagementOperationContext RemoveAzureVM(string vmName, string serviceName, bool deleteVhd = false, bool whatif = false)
{
- return RunPSCmdletAndReturnFirst(new RemoveAzureVMCmdletInfo(vmName, serviceName, deleteVhd));
+ return RunPSCmdletAndReturnFirst(new RemoveAzureVMCmdletInfo(vmName, serviceName, deleteVhd, whatif));
}
public ManagementOperationContext StartAzureVM(string vmName, string serviceName)
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/RemoveAzureVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/RemoveAzureVM.cs
index 5784f1d24125..c5a8d5df9322 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/RemoveAzureVM.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/RemoveAzureVM.cs
@@ -23,7 +23,7 @@
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS
{
- [Cmdlet(VerbsCommon.Remove, "AzureVM"), OutputType(typeof(ManagementOperationContext))]
+ [Cmdlet(VerbsCommon.Remove, "AzureVM", SupportsShouldProcess = true), OutputType(typeof(ManagementOperationContext))]
public class RemoveAzureVMCommand : IaaSDeploymentManagementCmdletBase
{
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the role to remove.")]
@@ -43,38 +43,41 @@ public SwitchParameter DeleteVHD
protected override void ExecuteCommand()
{
- ServiceManagementProfile.Initialize();
-
- base.ExecuteCommand();
- if (CurrentDeploymentNewSM == null)
+ if (this.ShouldProcess(String.Format("Service: {0}, VM: {1}", this.ServiceName, this.Name), Resources.RemoveAzureVMShouldProcessAction))
{
- return;
- }
+ ServiceManagementProfile.Initialize();
- DeploymentGetResponse deploymentGetResponse = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, DeploymentSlot.Production);
- if (deploymentGetResponse.Roles.FirstOrDefault(r => r.RoleName.Equals(Name, StringComparison.InvariantCultureIgnoreCase)) == null)
- {
- throw new ArgumentOutOfRangeException(String.Format(Resources.RoleInstanceCanNotBeFoundWithName, Name));
- }
+ base.ExecuteCommand();
+ if (CurrentDeploymentNewSM == null)
+ {
+ return;
+ }
- if (deploymentGetResponse.RoleInstances.Count > 1)
- {
- ExecuteClientActionNewSM(
- null,
- CommandRuntime.ToString(),
- () => this.ComputeClient.VirtualMachines.Delete(this.ServiceName, CurrentDeploymentNewSM.Name, Name, DeleteVHD.IsPresent));
- }
- else
- {
- if (deploymentGetResponse != null && !string.IsNullOrEmpty(deploymentGetResponse.ReservedIPName))
+ DeploymentGetResponse deploymentGetResponse = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, DeploymentSlot.Production);
+ if (deploymentGetResponse.Roles.FirstOrDefault(r => r.RoleName.Equals(Name, StringComparison.InvariantCultureIgnoreCase)) == null)
{
- WriteVerboseWithTimestamp(string.Format(Resources.ReservedIPNameNoLongerInUseByDeletingLastVMButStillBeingReserved, deploymentGetResponse.ReservedIPName));
+ throw new ArgumentOutOfRangeException(String.Format(Resources.RoleInstanceCanNotBeFoundWithName, Name));
}
- ExecuteClientActionNewSM(
- null,
- CommandRuntime.ToString(),
- () => this.ComputeClient.Deployments.DeleteByName(this.ServiceName, CurrentDeploymentNewSM.Name, DeleteVHD.IsPresent));
+ if (deploymentGetResponse.RoleInstances.Count > 1)
+ {
+ ExecuteClientActionNewSM(
+ null,
+ CommandRuntime.ToString(),
+ () => this.ComputeClient.VirtualMachines.Delete(this.ServiceName, CurrentDeploymentNewSM.Name, Name, DeleteVHD.IsPresent));
+ }
+ else
+ {
+ if (deploymentGetResponse != null && !string.IsNullOrEmpty(deploymentGetResponse.ReservedIPName))
+ {
+ WriteVerboseWithTimestamp(string.Format(Resources.ReservedIPNameNoLongerInUseByDeletingLastVMButStillBeingReserved, deploymentGetResponse.ReservedIPName));
+ }
+
+ ExecuteClientActionNewSM(
+ null,
+ CommandRuntime.ToString(),
+ () => this.ComputeClient.Deployments.DeleteByName(this.ServiceName, CurrentDeploymentNewSM.Name, DeleteVHD.IsPresent));
+ }
}
}
}
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.Designer.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.Designer.cs
index f3cb57a9fed3..61587543ea21 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.Designer.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34014
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -1429,6 +1429,15 @@ public static string RemoveAzureDnsServerWarning {
}
}
+ ///
+ /// Looks up a localized string similar to Deleting VM.
+ ///
+ public static string RemoveAzureVMShouldProcessAction {
+ get {
+ return ResourceManager.GetString("RemoveAzureVMShouldProcessAction", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Remove Reserved IP Association.
///
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.resx b/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.resx
index 143942ad19e9..8a6ca4ac560c 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.resx
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.resx
@@ -753,4 +753,7 @@
Upload '{0}'
{0} is the name of an storage blob
+
+ Deleting VM
+
\ No newline at end of file
diff --git a/tools/Installer/generate.ps1 b/tools/Installer/generate.ps1
index 3422d4d6c5b6..eef23adce6f5 100644
--- a/tools/Installer/generate.ps1
+++ b/tools/Installer/generate.ps1
@@ -1,3 +1,17 @@
+# ----------------------------------------------------------------------------------
+#
+# 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.
+# ----------------------------------------------------------------------------------
+
param(
[Parameter(Mandatory = $false, Position = 0)]
[string] $buildConfig
diff --git a/tools/PublishModules.ps1 b/tools/PublishModules.ps1
new file mode 100644
index 000000000000..5a80b036a65c
--- /dev/null
+++ b/tools/PublishModules.ps1
@@ -0,0 +1,69 @@
+# ----------------------------------------------------------------------------------
+#
+# 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.
+# ----------------------------------------------------------------------------------
+
+param(
+ [Parameter(Mandatory = $false, Position = 0)]
+ [string] $buildConfig,
+ [Parameter(Mandatory = $false, Position = 1)]
+ [string] $apiKey,
+ [Parameter(Mandatory = $false, Position = 2)]
+ [string] $repositoryLocation
+)
+
+if ([string]::IsNullOrEmpty($buildConfig))
+{
+ Write-Verbose "Setting build configuration to 'Release'"
+ $buildConfig = 'Release'
+}
+
+if ([string]::IsNullOrEmpty($repositoryLocation))
+{
+ Write-Verbose "Setting repository location to 'http://psget/PSGallery/api/v2/'"
+ $repositoryLocation = 'http://psget/PSGallery/api/v2/'
+}
+
+$packageFolder = "$PSScriptRoot\..\src\Package"
+$scriptFolder = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
+. ($scriptFolder + '.\SetupEnv.ps1')
+
+if (Test-Path $packageFolder) {
+ Remove-Item -Path $packageFolder -Recurse -Force
+}
+
+# Build the cmdlets in debug mode
+msbuild "$env:AzurePSRoot\build.proj" /t:"BuildDebug"
+
+$repoName = $(New-Guid).ToString()
+Register-PSRepository -Name $repoName -SourceLocation $repositoryLocation -PublishLocation $repositoryLocation -InstallationPolicy Trusted
+$modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure"
+# Publish Azure module
+Write-Host "Publishing Azure module from $modulePath"
+Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName
+Write-Host "Published Azure module"
+# Publish AzureRM.Profile module
+Write-Host "Publishing AzureRM.Profile module from $modulePath"
+Publish-Module -Path "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager\AzureRM.Profile" -NuGetApiKey $apiKey -Repository $repoName
+Write-Host "Published AzureRM.Profile module"
+
+# Publish AzureRM modules
+$resourceManagerModules = Get-ChildItem -Path "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager" -Directory
+foreach ($module in $resourceManagerModules) {
+ if ($module -ne "AzureRM.Profile") {
+ $modulePath = $module.FullName
+ Write-Host "Publishing $module module from $modulePath"
+ Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName
+ Write-Host "Published $module module"
+ }
+}
+Unregister-PSRepository -Name $repoName
\ No newline at end of file