Skip to content

Commit dba5567

Browse files
committed
Merge pull request #186 from huangpf/vmss
HPF PR: vmss <- huangpf:vmss
2 parents 40e12bf + 67299d8 commit dba5567

File tree

379 files changed

+16793
-6696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

379 files changed

+16793
-6696
lines changed

build.proj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@
4545
<Scope Condition=" $(Scope) == '' " >all</Scope>
4646
</PropertyGroup>
4747
<ItemGroup>
48-
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln"
48+
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln;.\src\Storage\Storage.sln"
4949
Exclude=".\src\ResourceManager\Intune\*.sln"
5050
Condition=" '$(Scope)' == 'all' "/>
5151
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
5252
Condition=" '$(Scope)' != 'all' and '$(Scope)' != 'ServiceManagement' and '$(Scope)' != 'AzureStorage' "/>
5353
<CmdletSolutionsToBuild Include=".\src\ServiceManagement\ServiceManagement.sln"
54-
Condition=" '$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage' "/>
54+
Condition=" '$(Scope)' == 'ServiceManagement'"/>
55+
<CmdletSolutionsToBuild Include=".\src\Storage\Storage.sln"
56+
Condition=" '$(Scope)' == 'AzureStorage' "/>
5557
<SetupSln Include=".\setup\azurepowershell.sln" />
5658
<StaticAnalysis Include=".\tools\StaticAnalysis\StaticAnalysis.sln" />
5759
</ItemGroup>

setup/azurecmd.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
7676
<CreateFolder />
7777
<!-- Work around bug that PowerShell does not always consider default module paths. -->
78-
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager\;[PowerShellFolder]ServiceManagement\" System="yes" />
78+
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager\;[PowerShellFolder]ServiceManagement\;[PowerShellFolder]\Storage" System="yes" />
7979
</Component>
8080
</DirectoryRef>
8181

setup/azurecmdfiles.wxi

Lines changed: 144 additions & 304 deletions
Large diffs are not rendered by default.

src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public static class WindowsAzureSubscriptionExtensions
3030
/// <summary>
3131
/// Get storage account details from the current storage account
3232
/// </summary>
33-
/// <param name="subscription">The subscription continign the account.</param>
34-
/// <param name="profile">The profile continaing the subscription.</param>
33+
/// <param name="subscription">The subscription containing the account.</param>
34+
/// <param name="profile">The profile continuing the subscription.</param>
3535
/// <returns>Storage account details, usable with the windows azure storage data plane library.</returns>
3636
public static CloudStorageAccount GetCloudStorageAccount(this AzureSubscription subscription, AzureSMProfile profile)
3737
{

src/Common/Commands.Common/CmdletExtensions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,22 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Collections.Generic;
1617
using System.Collections.ObjectModel;
18+
using System.IO;
1719
using System.Management.Automation;
1820
using System.Reflection;
1921

2022
namespace Microsoft.WindowsAzure.Commands.Utilities.Common
2123
{
2224
public static class CmdletExtensions
2325
{
26+
public static string AsAbsoluteLocation(this string realtivePath)
27+
{
28+
return Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, realtivePath));
29+
}
30+
2431
public static string TryResolvePath(this PSCmdlet psCmdlet, string path)
2532
{
2633
try

src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using System.Management.Automation;
2828
using System.Security.Cryptography.X509Certificates;
2929
using Microsoft.Azure.ServiceManagemenet.Common;
30+
using System.Text;
3031

3132
namespace Microsoft.WindowsAzure.Commands.ScenarioTest
3233
{
@@ -41,7 +42,7 @@ public class EnvironmentSetupHelper
4142
private AzureAccount testAccount;
4243

4344
private const string PackageDirectoryFromCommon = @"..\..\..\..\Package\Debug";
44-
private const string PackageDirectory = @"..\..\..\..\..\Package\Debug";
45+
public const string PackageDirectory = @"..\..\..\..\..\Package\Debug";
4546

4647
protected List<string> modules;
4748

@@ -210,11 +211,15 @@ public void SetupModules(AzureModule mode, params string[] modules)
210211
this.modules = new List<string>();
211212
if (mode == AzureModule.AzureProfile)
212213
{
214+
this.modules.Add(Path.Combine(PackageDirectory, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
215+
this.modules.Add(Path.Combine(PackageDirectory, @"Storage\Azure.Storage\Azure.Storage.psd1"));
213216
this.modules.Add(Path.Combine(PackageDirectory, @"ServiceManagement\Azure\Azure.psd1"));
214217
this.modules.Add(Path.Combine(PackageDirectory, @"ResourceManager\AzureResourceManager\AzureResourceManager.psd1"));
215218
}
216219
else if (mode == AzureModule.AzureServiceManagement)
217220
{
221+
this.modules.Add(Path.Combine(PackageDirectory, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
222+
this.modules.Add(Path.Combine(PackageDirectory, @"Storage\Azure.Storage\Azure.Storage.psd1"));
218223
this.modules.Add(Path.Combine(PackageDirectory, @"ServiceManagement\Azure\Azure.psd1"));
219224
}
220225
else if (mode == AzureModule.AzureResourceManager)
@@ -235,11 +240,15 @@ public void SetupModulesFromCommon(AzureModule mode, params string[] modules)
235240
this.modules = new List<string>();
236241
if (mode == AzureModule.AzureProfile)
237242
{
243+
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
244+
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"Storage\Azure.Storage\Azure.Storage.psd1"));
238245
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ServiceManagement\Azure\Azure.psd1"));
239246
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ResourceManager\AzureResourceManager\AzureResourceManager.psd1"));
240247
}
241248
else if (mode == AzureModule.AzureServiceManagement)
242249
{
250+
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
251+
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"Storage\Azure.Storage\Azure.Storage.psd1"));
243252
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ServiceManagement\Azure\Azure.psd1"));
244253
}
245254
else if (mode == AzureModule.AzureResourceManager)
@@ -263,53 +272,85 @@ public void SetupModules(params string[] modules)
263272
this.modules.AddRange(modules);
264273
}
265274

275+
266276
public virtual Collection<PSObject> RunPowerShellTest(params string[] scripts)
267277
{
268278
using (var powershell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
269279
{
270-
SetupPowerShellModules(powershell);
280+
return ExecuteShellTest(powershell, null, scripts);
281+
}
282+
}
283+
public virtual Collection<PSObject> RunPowerShellTest(IEnumerable<string> setupScripts, IEnumerable<string> scripts)
284+
{
285+
using (var powershell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
286+
{
287+
return ExecuteShellTest(powershell, setupScripts, scripts);
288+
}
289+
}
271290

272-
Collection<PSObject> output = null;
273-
for (int i = 0; i < scripts.Length; ++i)
274-
{
275-
Console.WriteLine(scripts[i]);
276-
powershell.AddScript(scripts[i]);
277-
}
278-
try
291+
private Collection<PSObject> ExecuteShellTest(
292+
System.Management.Automation.PowerShell powershell,
293+
IEnumerable<string> setupScripts,
294+
IEnumerable<string> scripts)
295+
{
296+
SetupPowerShellModules(powershell, null);
297+
298+
Collection<PSObject> output = null;
299+
300+
foreach (var script in scripts)
301+
{
302+
Console.WriteLine(script);
303+
powershell.AddScript(script);
304+
}
305+
try
306+
{
307+
powershell.Runspace.Events.Subscribers.Clear();
308+
powershell.Streams.Error.Clear();
309+
output = powershell.Invoke();
310+
311+
if (powershell.Streams.Error.Count > 0)
279312
{
280-
powershell.Runspace.Events.Subscribers.Clear();
281-
output = powershell.Invoke();
313+
var sb = new StringBuilder();
282314

283-
if (powershell.Streams.Error.Count > 0)
315+
sb.AppendLine("Test failed due to a non-empty error stream, check the error stream in the test log for more details.");
316+
sb.AppendLine(string.Format("{0} total Errors", powershell.Streams.Error.Count));
317+
foreach (var error in powershell.Streams.Error)
284318
{
285-
throw new RuntimeException(
286-
"Test failed due to a non-empty error stream, check the error stream in the test log for more details.");
319+
sb.AppendLine(error.Exception.ToString());
287320
}
288321

289-
return output;
290-
}
291-
catch (Exception psException)
292-
{
293-
powershell.LogPowerShellException(psException);
294-
throw;
295-
}
296-
finally
297-
{
298-
powershell.LogPowerShellResults(output);
299-
powershell.Streams.Error.Clear();
322+
throw new RuntimeException(sb.ToString());
300323
}
324+
325+
return output;
326+
}
327+
catch (Exception psException)
328+
{
329+
powershell.LogPowerShellException(psException);
330+
throw;
331+
}
332+
finally
333+
{
334+
powershell.LogPowerShellResults(output);
335+
powershell.Streams.Error.Clear();
301336
}
302337
}
303338

304-
private void SetupPowerShellModules(System.Management.Automation.PowerShell powershell)
339+
private void SetupPowerShellModules(System.Management.Automation.PowerShell powershell, IEnumerable<string> setupScripts)
305340
{
306341
powershell.AddScript("$error.clear()");
307342
powershell.AddScript(string.Format("cd \"{0}\"", AppDomain.CurrentDomain.BaseDirectory));
343+
if (setupScripts != null)
344+
{
345+
foreach(var script in setupScripts)
346+
{
347+
powershell.AddScript(script);
348+
}
349+
}
308350

309351
foreach (string moduleName in modules)
310352
{
311-
powershell.AddScript(string.Format("Import-Module \"{0}\"",
312-
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, moduleName)));
353+
powershell.AddScript(string.Format("Import-Module \"{0}\"", moduleName.AsAbsoluteLocation()));
313354
}
314355

315356
powershell.AddScript(

src/Common/Storage/Commands.Storage/PostBuild.ps1

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/ResourceManager/ApiManagement/ApiManagement.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Management.Storage
2626
EndProject
2727
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}"
2828
EndProject
29-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Common\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}"
29+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}"
3030
EndProject
3131
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}"
3232
EndProject

src/ResourceManager/ApiManagement/AzureRM.ApiManagement.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()

src/ResourceManager/Automation/AzureRM.Automation.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()

src/ResourceManager/AzureBackup/AzureRM.Backup.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/AzureBackupVaultScenarioTests.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@
8484
"x-ms-client-request-id": [
8585
"ff97c9dd-5838-4ec9-802a-dc1f5f06a3bf-2015-08-16 19:16:03Z-PS"
8686
],
87-
"x-ms-version": [
88-
"2013-03-01"
89-
],
9087
"User-Agent": [
9188
"Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/0.0.0.0"
9289
]
@@ -148,9 +145,6 @@
148145
"x-ms-client-request-id": [
149146
"fd70aa7c-a1db-42ed-8295-5cec7663d72d-2015-08-16 19:16:19Z-PS"
150147
],
151-
"x-ms-version": [
152-
"2013-03-01"
153-
],
154148
"User-Agent": [
155149
"Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/0.0.0.0"
156150
]
@@ -515,9 +509,6 @@
515509
"x-ms-client-request-id": [
516510
"43cf16e7-e7a0-4d56-8eb5-66f9ecee0ff4-2015-08-16 19:16:15Z-PS"
517511
],
518-
"x-ms-version": [
519-
"2013-03-01"
520-
],
521512
"User-Agent": [
522513
"Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/0.0.0.0"
523514
]

src/ResourceManager/AzureBatch/AzureRM.Batch.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()

src/ResourceManager/AzureStackAdmin/AzureRM.AzureStackAdmin.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ CLRVersion = '4.0'
4848
ProcessorArchitecture = ''
4949

5050
# Modules that must be imported into the global environment prior to importing this module
51-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.4'})
51+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.4'})
5252

5353
# Assemblies that must be loaded prior to importing this module
5454
# RequiredAssemblies = @()

src/ResourceManager/AzureStackStorage/AzureRM.AzureStackStorage.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.4'})
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.4'})
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public string RMStorageDataPlaneModule
107107
get
108108
{
109109
return Path.Combine(this.PackageDirectory,
110-
@"ResourceManager\AzureResourceManager\Azure.Storage\Azure.Storage.psd1");
110+
@"Storage\Azure.Storage\Azure.Storage.psd1");
111111
}
112112
}
113113

src/ResourceManager/Compute/AzureRM.Compute.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.Management.Network, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
71+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.3.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/Compute/Commands.Compute.Test/ConfigFiles/DiagnosticsExtensionConfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@
8686
"scheduledTransferLogLevelFilter": "Error",
8787
"scheduledTransferPeriod": "PT1M"
8888
},
89+
"Metrics": {
90+
"resourceId": "dummy",
91+
"MetricAggregation": [
92+
{
93+
"scheduledTransferPeriod": "PT1M"
94+
}
95+
]
96+
},
8997
"overallQuotaInMB": 4096
9098
}
9199
}

src/ResourceManager/Compute/Commands.Compute.Test/ConfigFiles/DiagnosticsExtensionConfig.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
<CrashDumpConfiguration processName="w3wp.exe" />
2727
</CrashDumps>
2828
<Logs scheduledTransferPeriod="PT3M" />
29+
<Metrics resourceId="dummy">
30+
<MetricAggregation scheduledTransferPeriod="PT1M"/>
31+
</Metrics>
2932
</DiagnosticMonitorConfiguration>
3033
</WadCfg>
3134
<StorageAccount>definedinconfigstorage</StorageAccount>

0 commit comments

Comments
 (0)