Skip to content

Commit d67cece

Browse files
committed
Merge branch 'preview' of github.com:Azure/azure-powershell into sksingh3
2 parents 7b25dc7 + 046c07b commit d67cece

File tree

477 files changed

+307787
-13319
lines changed

Some content is hidden

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

477 files changed

+307787
-13319
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ FakesAssemblies/
215215
*.GhostDoc.xml
216216
pingme.txt
217217
groupMapping*.json
218+
/tools/index.json
219+
/Package/index.json
218220

219221
*.msi
220222
*.wixpdb

Azure.PowerShell.Netcore.sln

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Consumption.Netcor
7373
EndProject
7474
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.ContainerRegistry.Netcore", "src\ResourceManager\ContainerRegistry\Commands.ContainerRegistry\Commands.ContainerRegistry.Netcore.csproj", "{49A69011-CEFF-464B-AC2E-5A387EFFBE8B}"
7575
EndProject
76-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.DataFactoryV2.Netcore", "src\ResourceManager\DataFactories\Commands.DataFactoryV2\Commands.DataFactoryV2.Netcore.csproj", "{EAC7B54E-974B-435F-95CE-B01CC2F955A3}"
76+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.DataFactoryV2.Netcore", "src\ResourceManager\DataFactoryV2\Commands.DataFactoryV2\Commands.DataFactoryV2.Netcore.csproj", "{EAC7B54E-974B-435F-95CE-B01CC2F955A3}"
7777
EndProject
7878
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.DataLakeAnalytics.Netcore", "src\ResourceManager\DataLakeAnalytics\Commands.DataLakeAnalytics\Commands.DataLakeAnalytics.Netcore.csproj", "{CC0D2BA5-B087-4206-9F98-CD8230AADEF3}"
7979
EndProject
@@ -175,6 +175,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.RedisCache.Netcore
175175
EndProject
176176
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.AnalysisServices.Dataplane.Netcore", "src\ResourceManager\AnalysisServices\Commands.AnalysisServices.Dataplane\Commands.AnalysisServices.Dataplane.Netcore.csproj", "{F172B347-4B1F-4888-A5B9-3D05303C0E6F}"
177177
EndProject
178+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Storage.Netcore", "src\Storage\Commands.Storage\Commands.Storage.Netcore.csproj", "{4F18000A-0329-4450-ADC8-8AA1C04A4666}"
179+
EndProject
178180
Global
179181
GlobalSection(SolutionConfigurationPlatforms) = preSolution
180182
Debug|Any CPU = Debug|Any CPU
@@ -1205,6 +1207,18 @@ Global
12051207
{F172B347-4B1F-4888-A5B9-3D05303C0E6F}.Release|x64.Build.0 = Release|Any CPU
12061208
{F172B347-4B1F-4888-A5B9-3D05303C0E6F}.Release|x86.ActiveCfg = Release|Any CPU
12071209
{F172B347-4B1F-4888-A5B9-3D05303C0E6F}.Release|x86.Build.0 = Release|Any CPU
1210+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1211+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Debug|Any CPU.Build.0 = Debug|Any CPU
1212+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Debug|x64.ActiveCfg = Debug|Any CPU
1213+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Debug|x64.Build.0 = Debug|Any CPU
1214+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Debug|x86.ActiveCfg = Debug|Any CPU
1215+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Debug|x86.Build.0 = Debug|Any CPU
1216+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Release|Any CPU.ActiveCfg = Release|Any CPU
1217+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Release|Any CPU.Build.0 = Release|Any CPU
1218+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Release|x64.ActiveCfg = Release|Any CPU
1219+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Release|x64.Build.0 = Release|Any CPU
1220+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Release|x86.ActiveCfg = Release|Any CPU
1221+
{4F18000A-0329-4450-ADC8-8AA1C04A4666}.Release|x86.Build.0 = Release|Any CPU
12081222
EndGlobalSection
12091223
GlobalSection(SolutionProperties) = preSolution
12101224
HideSolutionNode = FALSE

TestMappings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@
5959
],
6060
"src/ResourceManager/DataFactories/": [
6161
".\\src\\ResourceManager\\DataFactories\\Commands.DataFactories.Test\\bin\\Debug\\Microsoft.Azure.Commands.DataFactories.Test.dll",
62-
".\\src\\ResourceManager\\DataFactories\\Commands.DataFactoryV2.Test\\bin\\Debug\\Microsoft.Azure.Commands.DataFactoryV2.Test.dll",
6362
".\\src\\ResourceManager\\StreamAnalytics\\Commands.StreamAnalytics.Test\\bin\\Debug\\Microsoft.Azure.Commands.StreamAnalytics.Test.dll"
6463
],
64+
"src/ResourceManager/DataFactoryV2/": [
65+
".\\src\\ResourceManager\\DataFactoryV2\\Commands.DataFactoryV2.Test\\bin\\Debug\\Microsoft.Azure.Commands.DataFactoryV2.Test.dll"
66+
],
6567
"src/ResourceManager/DataLakeAnalytics/": [
6668
".\\src\\ResourceManager\\DataLakeAnalytics\\Commands.DataLakeAnalytics.Test\\bin\\Debug\\Microsoft.Azure.Commands.DataLakeAnalytics.Test.dll"
6769
],

build.proj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@
201201
<Message Importance="high" Text="Building Cmdlets..." />
202202

203203
<MakeDir Directories="$(PackageDirectory)" />
204-
<Exec ContinueOnError="false"
205-
Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot; . $(LibraryToolsFolder)\CreateMappings.ps1 -RootPath $(LibrarySourceFolder) -OutputFile $(PackageDirectory)\groupMapping.json -WarningFile $(PackageDirectory)\groupMappingWarnings.json -RulesFile $(LibraryToolsFolder)\CreateMappings_rules.json &quot;" Condition="'$(Latest)' == 'true'"/>
206204

207205
<MSBuild
208206
Projects="@(CmdletSolutionsToBuild)"
@@ -218,6 +216,10 @@
218216

219217
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Latest &quot; " Condition="'$(Latest)' == 'true' and '$(CodeSign)' == 'false'"/>
220218
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Stack &quot; " Condition="'$(Stack)' == 'true' and '$(CodeSign)' == 'false'"/>
219+
220+
<Exec ContinueOnError="false"
221+
Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot; . $(LibraryToolsFolder)\NewHelpIndex.ps1 -OutputFile $(PackageDirectory)\index.json -BuildConfig $(Configuration) &quot;" Condition="'$(Latest)' == 'true'"/>
222+
221223
<!-- Copying shortcut to be signed -->
222224
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
223225
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" Condition= " '$(NetCore)' == 'false' and '$(Latest)' == 'true'"/>
@@ -252,6 +254,7 @@
252254

253255
<Message Importance="high" Text="Running Static Analyser" />
254256
<CallTarget targets="DependencyAnalysis" ContinueOnError="ErrorAndContinue" />
257+
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CheckAssemblies.ps1 &quot;" />
255258
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CleanupBuild.ps1 -BuildConfig $(Configuration) &quot;" />
256259
</Target>
257260

src/Common/Commands.Common/AzureDataCmdlet.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,24 @@ protected override void ConfirmAction(bool force, string continueMessage, string
7878
ConfirmAction(force, continueMessage, processMessage, target, action, () => true);
7979
}
8080

81-
#if !NETSTANDARD
8281
public IAzureContextContainer SMProfile
8382
{
8483
get
8584
{
85+
#if NETSTANDARD
86+
return null;
87+
#else
8688
IAzureContextContainer result = null;
8789
if (AzureSMProfileProvider.Instance != null)
8890
{
8991
result = AzureSMProfileProvider.Instance.Profile;
9092
}
9193

9294
return result;
95+
#endif
9396
}
9497
}
95-
#endif
98+
9699

97100
protected override string DataCollectionWarning
98101
{

src/ResourceManager/Aks/AzureRM.Aks.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ CLRVersion = '4.0'
5454
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '4.1.1'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = '.\YamlDotNet.dll',
58-
'.\Microsoft.Azure.Commands.Common.Graph.RBAC.dll',
59-
'.\AutoMapper.dll'
57+
RequiredAssemblies = '.\YamlDotNet.dll',
58+
'.\Microsoft.Azure.Commands.Common.Graph.RBAC.dll',
59+
'.\AutoMapper.dll', '.\System.Management.Automation.dll'
6060

6161
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
6262
# ScriptsToProcess = @()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
Module Name: AzureRM.ApplicationInsights
3+
Module Guid: da67eaa7-4cb1-4bfa-a194-8bf3faae8ac6
4+
Download Help Link: None
5+
Help Version: 0.1.2
6+
Locale: en-US
7+
---
8+
9+
# AzureRM.ApplicationInsights Module
10+
## Description
11+
Creates and manages application insights in Azure Resource Manager.
12+
13+
## AzureRM.ApplicationInsights Cmdlets
14+
### [Get-AzureRmApplicationInsights](Get-AzureRmApplicationInsights.md)
15+
Get application insights resources
16+
17+
### [Get-AzureRmApplicationInsightsApiKey](Get-AzureRmApplicationInsightsApiKey.md)
18+
Get application insights api keys for an application insights resource
19+
20+
### [Get-AzureRmApplicationInsightsContinuousExport](Get-AzureRmApplicationInsightsContinuousExport.md)
21+
Get application insights continuous export configuration for an application insights resource
22+
23+
### [New-AzureRmApplicationInsights](New-AzureRmApplicationInsights.md)
24+
Create a new application insights resource
25+
26+
### [New-AzureRmApplicationInsightsApiKey](New-AzureRmApplicationInsightsApiKey.md)
27+
Create an application insights api key for an application insights resource
28+
29+
### [New-AzureRmApplicationInsightsContinuousExport](New-AzureRmApplicationInsightsContinuousExport.md)
30+
Create a new application insights continuous export configuration for an application insights resource
31+
32+
### [Remove-AzureRmApplicationInsights](Remove-AzureRmApplicationInsights.md)
33+
Remove an application insights resource
34+
35+
### [Remove-AzureRmApplicationInsightsApiKey](Remove-AzureRmApplicationInsightsApiKey.md)
36+
Remove an application insights api key for an application insights resource
37+
38+
### [Remove-AzureRmApplicationInsightsContinuousExport](Remove-AzureRmApplicationInsightsContinuousExport.md)
39+
Remove a cotinuous export configuration in an application insights resource
40+
41+
### [Set-AzureRmApplicationInsightsContinuousExport](Set-AzureRmApplicationInsightsContinuousExport.md)
42+
Update a continuous export configuration in an applciation insights resource
43+
44+
### [Set-AzureRmApplicationInsightsDailyCap](Set-AzureRmApplicationInsightsDailyCap.md)
45+
Set daily data volume cap for an application insights resource
46+
47+
### [Set-AzureRmApplicationInsightsPricingPlan](Set-AzureRmApplicationInsightsPricingPlan.md)
48+
Set pricing plan and daily data volume information for an applicaiton insights resource
49+

src/ResourceManager/AzureBackup/Commands.AzureBackup/help/AzureRM.Backup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: AzureRM.Backup
3-
Module Guid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
3+
Module Guid: 0b1d76f5-a928-4b8f-9c83-df26947568d4
44
Download Help Link: {{Please enter FwLink manually}}
55
Help Version: {{Please enter version of help manually (X.X.X.X) format}}
66
Locale: en-US

src/ResourceManager/AzureBatch/Commands.Batch/help/AzureRM.Batch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: AzureRM.Batch
3-
Module Guid: Batch_Cmdlets_D48CF693-4125-4D2D-879
3+
Module Guid: a8f00f40-1c1a-49b5-9db3-24076b75c3cf
44
Download Help Link: http://go.microsoft.com/fwlink/?linkid=390762
55
Help Version: 4.0.0.0
66
Locale: en-US

src/ResourceManager/Billing/AzureRM.Billing.Netcore.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ NestedModules = @('.\Microsoft.Azure.Commands.Billing.dll')
7272
FunctionsToExport = @()
7373

7474
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75-
CmdletsToExport = 'Get-AzureRmBillingInvoice', 'Get-AzureRmBillingPeriod'
75+
CmdletsToExport = 'Get-AzureRmBillingInvoice', 'Get-AzureRmBillingPeriod', 'Get-AzureRmEnrollmentAccount'
7676

7777
# Variables to export from this module
7878
# VariablesToExport = @()

src/ResourceManager/Billing/AzureRM.Billing.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ NestedModules = @('.\Microsoft.Azure.Commands.Billing.dll')
7272
FunctionsToExport = @()
7373

7474
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75-
CmdletsToExport = 'Get-AzureRmBillingInvoice', 'Get-AzureRmBillingPeriod'
75+
CmdletsToExport = 'Get-AzureRmBillingInvoice', 'Get-AzureRmBillingPeriod', 'Get-AzureRmEnrollmentAccount'
7676

7777
# Variables to export from this module
7878
# VariablesToExport = @()

src/ResourceManager/Billing/ChangeLog.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* New Cmdlet Get-AzureRmEnrollmentAccount
22+
- cmdlet to retrieve enrollment accounts
2123
* Updated to the latest version of the Azure ClientRuntime
2224

2325
## Version 0.14.0
@@ -44,8 +46,8 @@
4446
* New Cmdlet Get-AzureRmBillingPeriod
4547
- cmdlet to retrieve azure billing periods of the subscription.
4648
* Update Cmdlet Get-AzureRmBillingInvoice
47-
- new property BillingPeriodNames
48-
- output in list view
49+
- new property BillingPeriodNames
50+
- output in list view
4951

5052
## Version 0.11.0
5153

src/ResourceManager/Billing/Commands.Billing.Test/Commands.Billing.Test.csproj

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<Private>True</Private>
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Management.Billing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
66-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Billing.2.0.0-preview\lib\net452\Microsoft.Azure.Management.Billing.dll</HintPath>
66+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Billing.2.1.0-preview\lib\net452\Microsoft.Azure.Management.Billing.dll</HintPath>
6767
</Reference>
6868
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6969
<SpecificVersion>False</SpecificVersion>
@@ -86,12 +86,12 @@
8686
</Reference>
8787
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8888
<SpecificVersion>False</SpecificVersion>
89-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.2.9-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
89+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.3.1\lib\net452\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
9090
<Private>True</Private>
9191
</Reference>
92-
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework, Version=1.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
92+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9393
<SpecificVersion>False</SpecificVersion>
94-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
94+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.7.2\lib\net452\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
9595
<Private>True</Private>
9696
</Reference>
9797
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
@@ -131,13 +131,17 @@
131131
</ItemGroup>
132132
<ItemGroup>
133133
<Compile Include="Properties\AssemblyInfo.cs" />
134+
<Compile Include="ScenarioTests\EnrollmentAccountTests.cs" />
134135
<Compile Include="ScenarioTests\BillingPeriodsTests.cs" />
135136
<Compile Include="ScenarioTests\InvoicesTests.cs" />
136137
<Compile Include="ScenarioTests\TestController.cs" />
137138
</ItemGroup>
138139
<ItemGroup>
139140
<None Include="MSSharedLibKey.snk" />
140141
<None Include="packages.config" />
142+
<None Include="ScenarioTests\EnrollmentAccountTests.ps1">
143+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
144+
</None>
141145
<None Include="ScenarioTests\BillingPeriodsTests.ps1">
142146
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
143147
</None>
@@ -174,6 +178,12 @@
174178
<None Include="SessionRecords\Microsoft.Azure.Commands.Billing.Test.ScenarioTests.InvoicesTests\TestListInvoicesWithMaxCount.json">
175179
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
176180
</None>
181+
<None Include="SessionRecords\Microsoft.Azure.Commands.Billing.Test.ScenarioTests.EnrollmentAccountTests\TestGetEnrollmentAccountWithName.json">
182+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
183+
</None>
184+
<None Include="SessionRecords\Microsoft.Azure.Commands.Billing.Test.ScenarioTests.EnrollmentAccountTests\TestListEnrollmentAccounts.json">
185+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
186+
</None>
177187
</ItemGroup>
178188
<ItemGroup>
179189
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication.Abstractions\Commands.Common.Authentication.Abstractions.csproj">

src/ResourceManager/Billing/Commands.Billing.Test/ScenarioTests/BillingPeriodsTests.ps1

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ List billing periods
1818
#>
1919
function Test-ListBillingPeriods
2020
{
21-
$billingBillingPeriods = Get-AzureRmBillingPeriod
21+
$billingPeriods = Get-AzureRmBillingPeriod
2222

23-
Assert-True {$billingBillingPeriods.Count -ge 1}
24-
Assert-NotNull $billingBillingPeriods[0].Name
25-
Assert-NotNull $billingBillingPeriods[0].Id
26-
Assert-NotNull $billingBillingPeriods[0].Type
27-
Assert-NotNull $billingBillingPeriods[0].BillingPeriodStartDate
28-
Assert-NotNull $billingBillingPeriods[0].BillingPeriodEndDate
23+
Assert-True {$billingPeriods.Count -ge 1}
24+
Assert-NotNull $billingPeriods[0].Name
25+
Assert-NotNull $billingPeriods[0].Id
26+
Assert-NotNull $billingPeriods[0].Type
27+
Assert-NotNull $billingPeriods[0].BillingPeriodStartDate
28+
Assert-NotNull $billingPeriods[0].BillingPeriodEndDate
2929
}
3030

3131
<#
@@ -34,14 +34,14 @@ List billing periods with MaxCount
3434
#>
3535
function Test-ListBillingPeriodsWithMaxCount
3636
{
37-
$billingBillingPeriods = Get-AzureRmBillingPeriod -MaxCount 1
37+
$billingPeriods = Get-AzureRmBillingPeriod -MaxCount 1
3838

39-
Assert-True {$billingBillingPeriods.Count -eq 1}
40-
Assert-NotNull $billingBillingPeriods[0].Name
41-
Assert-NotNull $billingBillingPeriods[0].Id
42-
Assert-NotNull $billingBillingPeriods[0].Type
43-
Assert-NotNull $billingBillingPeriods[0].BillingPeriodStartDate
44-
Assert-NotNull $billingBillingPeriods[0].BillingPeriodEndDate
39+
Assert-True {$billingPeriods.Count -eq 1}
40+
Assert-NotNull $billingPeriods[0].Name
41+
Assert-NotNull $billingPeriods[0].Id
42+
Assert-NotNull $billingPeriods[0].Type
43+
Assert-NotNull $billingPeriods[0].BillingPeriodStartDate
44+
Assert-NotNull $billingPeriods[0].BillingPeriodEndDate
4545
}
4646

4747
<#
@@ -50,7 +50,12 @@ Get billing period with specified name
5050
#>
5151
function Test-GetBillingPeriodWithName
5252
{
53-
$billingPeriodName = "201705-1"
53+
$billingPeriods = Get-AzureRmBillingPeriod | where { $_.InvoiceNames.Count -eq 1 }
54+
Assert-True {$billingPeriods.Count -ge 1}
55+
56+
$billingPeriodName = $billingPeriods[0].Name
57+
$billingInvoiceName = $billingPeriods[0].InvoiceNames[0]
58+
5459
$billingPeriod = Get-AzureRmBillingPeriod -Name $billingPeriodName
5560

5661
Assert-AreEqual $billingPeriodName $billingPeriod.Name
@@ -60,7 +65,7 @@ function Test-GetBillingPeriodWithName
6065
Assert-NotNull $billingPeriod.BillingPeriodEndDate
6166
Assert-NotNull $billingPeriod.InvoiceNames
6267
Assert-AreEqual 1 $billingPeriod.InvoiceNames.Count
63-
Assert-AreEqual "201705-217994100075389" $billingPeriod.InvoiceNames
68+
Assert-AreEqual $billingInvoiceName $billingPeriod.InvoiceNames
6469
}
6570

6671
<#
@@ -69,17 +74,18 @@ Get billing period with specified names
6974
#>
7075
function Test-GetBillingPeriodWithNames
7176
{
72-
$billingPeriodNames = "201705-1", "201704-1", "201703-1"
73-
$billingBillingPeriods = Get-AzureRmBillingPeriod -Name $billingPeriodNames
77+
$sampleBillingPeriods = Get-AzureRmBillingPeriod
78+
Assert-True {$sampleBillingPeriods.Count -gt 1}
79+
80+
$billingPeriodNames = $sampleBillingPeriods | %{ $_.Name }
81+
$billingPeriods = Get-AzureRmBillingPeriod -Name $billingPeriodNames
7482

75-
Assert-True {$billingBillingPeriods.Count -eq 3}
76-
Foreach($billingPeriod in $billingBillingPeriods)
83+
Assert-AreEqual $sampleBillingPeriods.Count $billingPeriods.Count
84+
Foreach($billingPeriod in $billingPeriods)
7785
{
7886
Assert-NotNull $billingPeriod.Id
7987
Assert-NotNull $billingPeriod.Type
8088
Assert-NotNull $billingPeriod.BillingPeriodStartDate
8189
Assert-NotNull $billingPeriod.BillingPeriodEndDate
82-
Assert-NotNull $billingPeriod.InvoiceNames
83-
Assert-AreEqual 1 $billingPeriod.InvoiceNames.Count
8490
}
8591
}

0 commit comments

Comments
 (0)