Skip to content

Commit 8881af3

Browse files
committed
Merge branch 'preview' of https://github.com/MSSedusch/azure-powershell into preview
2 parents cfe22e5 + 5153920 commit 8881af3

File tree

1,962 files changed

+97447
-442190
lines changed

Some content is hidden

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

1,962 files changed

+97447
-442190
lines changed

AzurePowershell.Test.targets

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<InsightsTestDebug>.\src\ResourceManager\Insights\Commands.Insights.Test\bin\Debug\Microsoft.Azure.Commands.Insights.Test.dll</InsightsTestDebug>
3333
<StorageTestDebug>.\src\Storage\Commands.Storage.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Storage.Test.dll</StorageTestDebug>
3434
<KeyVaultTestDebug>.\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll</KeyVaultTestDebug>
35+
<ServiceFabricTestDebug>.\src\ResourceManager\ServiceFabric\Commands.ServiceFabric.Test\bin\Debug\Microsoft.Azure.Commands.ServiceFabric.Test.dll</ServiceFabricTestDebug>
3536
<DataLakeAnalyticsTestDebug>.\src\ResourceManager\DataLakeAnalytics\Commands.DataLakeAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.DataLakeAnalytics.Test.dll</DataLakeAnalyticsTestDebug>
3637
<DataLakeStoreTestDebug>.\src\ResourceManager\DataLakeStore\Commands.DataLakeStore.Test\bin\Debug\Microsoft.Azure.Commands.DataLakeStore.Test.dll</DataLakeStoreTestDebug>
3738
<UsageAggregationTestDebug>.\src\ResourceManager\UsageAggregates\Commands.UsageAggregates.Test\bin\Debug\Microsoft.Azure.Commands.UsageAggregates.Test.dll</UsageAggregationTestDebug>
@@ -74,6 +75,7 @@
7475
<XUnitTests Include=".\src\ResourceManager\Billing\Commands.Billing.Test\bin\Debug\Microsoft.Azure.Commands.Billing.Test.dll"/>
7576
<XUnitTests Include=".\src\ResourceManager\Cdn\Commands.Cdn.Test\bin\Debug\Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.dll"/>
7677
<XUnitTests Include=".\src\ResourceManager\CognitiveServices\CognitiveServices.Test\bin\Debug\Microsoft.Azure.Commands.Management.CognitiveServices.Test.dll"/>
78+
<XUnitTests Include=".\src\ResourceManager\ContainerRegistry\Commands.ContainerRegistry.Test\bin\Debug\Microsoft.Azure.Commands.ContainerRegistry.Test.dll"/>
7779
<XUnitTests Include=".\src\ResourceManager\Compute\Commands.Compute.Test\bin\Debug\Microsoft.Azure.Commands.Compute.Test.dll"/>
7880
<XUnitTests Include=".\src\ResourceManager\DataFactories\Commands.DataFactories.Test\bin\Debug\Microsoft.Azure.Commands.DataFactories.Test.dll"/>
7981
<XUnitTests Include=".\src\ResourceManager\DataLakeAnalytics\Commands.DataLakeAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.DataLakeAnalytics.Test.dll"/>
@@ -84,6 +86,7 @@
8486
<XUnitTests Include=".\src\ResourceManager\Insights\Commands.Insights.Test\bin\Debug\Microsoft.Azure.Commands.Insights.Test.dll"/>
8587
<XUnitTests Include=".\src\ResourceManager\IotHub\Commands.IotHub.Test\bin\Debug\Microsoft.Azure.Commands.IotHub.Test.dll"/>
8688
<XUnitTests Include=".\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll"/>
89+
<XUnitTests Include=".\src\ResourceManager\ServiceFabric\Commands.ServiceFabric.Test\bin\Debug\Microsoft.Azure.Commands.ServiceFabric.Test.dll"/>
8790
<XUnitTests Include=".\src\ResourceManager\LogicApp\Commands.LogicApp.Test\bin\Debug\Microsoft.Azure.Commands.LogicApp.Test.dll"/>
8891
<XUnitTests Include=".\src\ResourceManager\Network\Commands.Network.Test\bin\Debug\Microsoft.Azure.Commands.Network.Test.dll"/>
8992
<XUnitTests Include=".\src\ResourceManager\NotificationHubs\Commands.NotificationHubs.Test\bin\Debug\Microsoft.Azure.Commands.NotificationHubs.Test.dll"/>
@@ -371,6 +374,13 @@
371374
<Xunit.Runner.MSBuild.xunit Assemblies="$(KeyVaultTestDebug)" Html="$(TestOutputDirectory)\KeyVaultTests.xunit.dll.html" Verbose="true"
372375
IncludeTraits="$(XUnitIncludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false"/>
373376
</Target>
377+
378+
<!-- Run the ServiceFabric tests -->
379+
<Target Name="ServiceFabricTests">
380+
<Message Importance="high" Text="Running ServiceFabric tests" />
381+
<Xunit.Runner.MSBuild.xunit Assemblies="$(KeyVaultTestDebug)" Html="$(TestOutputDirectory)\ServiceFabricTests.xunit.dll.html" Verbose="true"
382+
IncludeTraits="$(XUnitIncludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false"/>
383+
</Target>
374384

375385
<!-- Run the DataLakeAnalytics tests -->
376386
<Target Name="DataLakeAnalyticsTests">

build.proj

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
'AzureStorage': storage data plane cmdlets
2525
'Subfolder under src\ResourceManager': An individual cmdlet module
2626
By default, it builds all
27+
28+
/p:SkipHelp=True
29+
Skips help generation and installer creation, mainly for local builds to save time.
2730
-->
2831

2932
<!-- Define build properties -->
@@ -44,6 +47,7 @@
4447
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
4548
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' == '' ">http://psget/PSGallery/api/v2/</NuGetPublishingSource>
4649
<Scope Condition=" $(Scope) == '' " >all</Scope>
50+
<SkipHelp Condition =" '$(SkipHelp)' == '' ">false</SkipHelp>
4751
</PropertyGroup>
4852
<ItemGroup>
4953
<CmdletSolutionsToBuild Include=".\src\Storage\Storage.sln;.\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln;"
@@ -177,23 +181,27 @@
177181
<Target Name="Build" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">
178182
<Message Importance="high" Text="Building Cmdlets..." />
179183

180-
<Exec ContinueOnError="false" Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot; . $(LibraryToolsFolder)\CreateMappings.ps1 -RootPath $(LibrarySourceFolder) -OutputFile $(PackageDirectory)\groupMapping.json -WarningFile $(PackageDirectory)\groupMappingWarnings.json -RulesFile $(LibraryToolsFolder)\CreateMappings_rules.json &quot;"/>
184+
<MakeDir Directories="$(PackageDirectory)\$(Configuration)"/>
185+
<Exec ContinueOnError="false" Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot; . $(LibraryToolsFolder)\CreateMappings.ps1 -RootPath $(LibrarySourceFolder) -OutputFile $(PackageDirectory)\$(Configuration)\groupMapping.json -WarningFile $(PackageDirectory)\$(Configuration)\groupMappingWarnings.json -RulesFile $(LibraryToolsFolder)\CreateMappings_rules.json &quot;"/>
181186

182187
<MSBuild
183188
Projects="@(CmdletSolutionsToBuild)"
184189
Targets="Build"
185190
Properties="Configuration=$(Configuration);Platform=Any CPU"
186191
BuildInParallel="$(BuildInParallel)"
187-
ContinueOnError="false" />
188-
192+
ContinueOnError="false" />
193+
194+
<Exec Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\GenerateHelp.ps1 -ValidateMarkdownHelp -GenerateMamlHelp -BuildConfig $(Configuration) &quot;"
195+
ContinueOnError="false"
196+
Condition=" '$(SkipHelp)' == 'false' "/>
189197
<CallTarget Targets="BuildSetupTest"/>
190198
<CallTarget Targets="CodeSignBinaries" Condition=" '$(CodeSign)' == 'true' " />
191-
<CallTarget Targets="BuildSetup"/>
199+
<CallTarget Targets="BuildSetup" Condition=" '$(SkipHelp)' == 'false' "/>
192200
<CallTarget Targets="CodeSignInstaller"
193201
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == 'all'" />
194-
195202
<Message Importance="high" Text="Running Static Analyser" />
196-
<CallTarget targets="DependencyAnalysis" />
203+
<CallTarget targets="DependencyAnalysis" ContinueOnError="ErrorAndContinue" />
204+
<Exec Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CleanupBuild.ps1 -BuildConfig $(Configuration) &quot;" />
197205
</Target>
198206

199207
<!-- Do everything possible -->

documentation/help-generation.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Azure PowerShell Help Generation
2+
3+
## Description
4+
5+
All MAML files containing the help content for cmdlets have been removed from the Azure PowerShell repository and replaced with markdown files, which are generated and maintained using the [`platyPS`](https://github.com/PowerShell/platyPS) module. Each module has a `help` folder (_e.g.,_ `src/ResourceManager/Profile/Commands.Profile/help`) which contains a markdown file for each of the cmdlets found in that given module. When the help content for a cmdlet (or multiple cmdlets) needs to be updated, users will now only have to update the contents of the markdown file, _and not the MAML file as well_.
6+
7+
## Installing `platyPS`
8+
9+
In order to use the cmdlets necessary to update the markdown help files (or generate MAML help locally from these markdown files), you must first install the `platyPS` module mentioned previously.
10+
11+
To do so, you can can follow the below steps (which are outlined in the [**Quick start**](https://github.com/PowerShell/platyPS#quick-start) section of the `platyPS` README):
12+
13+
```powershell
14+
Install-Module -Name platyPS -Scope CurrentUser
15+
Import-Module platyPS
16+
```
17+
18+
**Note:** this module will need to be installed from the [PowerShell Gallery](http://www.powershellgallery.com/). If, for some reason, this isn't a registered repository when running the `Get-PSRepository` cmdlet, then you will need to register it by running the following command:
19+
20+
```powershell
21+
Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/
22+
```
23+
24+
## Using `platyPS`
25+
26+
### Importing your module
27+
28+
Before you run the `platyPS` cmdlets to update your markdown help files, you will need to first import the module containing the changes that you have made to your cmdlets into your current PowerShell session. Once you have built your project (either through Visual Studio or with `msbuild`), you can locate the module manifest that you will need to import in the `src/Package/Debug` folder of your local repository.
29+
30+
For example, if you have made changes to the `Profile` module, you will find the corresponding module manifest in `src/Package/Debug/ResourceManager/AzureResourceManager/AzureRM.Profile/AzureRM.Profile.psd1`.
31+
32+
Once you have located the module manifest, you can import it in your current PowerShell session by running the following command:
33+
34+
```powershell
35+
$PathToModuleManifest = "../../<module>.psd1"
36+
Import-Module -Name $PathToModuleManifest
37+
```
38+
39+
**Note**: if you do not see all of the changes you made to the cmdlets in your markdown files (_e.g.,_ a cmdlet you deleted is still appearing), you may need to delete any existing Azure PowerShell modules that you have on your machine (installed either through the PowerShell Gallery or by Web Platform Installer) before you import your module.
40+
41+
### Updating help after making cmdlet changes
42+
43+
Whenever the public interface for a cmdlet has changed, the corresponding markdown file for that cmdlet will need to be updated to reflect the changes. Public interface changes include the following:
44+
45+
- Add/change/remove parameter set
46+
- Add/remove parameter
47+
- Change attribute of a parameter
48+
- Type
49+
- Parameter set(s)
50+
- Aliases
51+
- Mandatory
52+
- Position
53+
- Accept pipeline input
54+
- Add/change output type
55+
56+
#### Updating all markdown files in a module
57+
58+
To update all of the markdown files for a single module, use the [`Update-MarkdownHelpModule`](https://github.com/PowerShell/platyPS/blob/master/docs/Update-MarkdownHelpModule.md) cmdlet:
59+
60+
```powershell
61+
$PathToModuleManifest = "../../<module.psd1" # Full path to the module manifest that you have updated
62+
Import-Module -Name $PathToModuleManifest
63+
64+
$PathToHelpFolder = "../../help" # Full path to help folder containing markdown files to be updated
65+
Update-MarkdownHelpModule -Path $PathToHelpFolder -RefreshModulePage -AlphabeticParamsOrder
66+
```
67+
68+
This will update all of the markdown files with public interface changes made to corresponding cmdlets, add markdown files for any new cmdlets, remove markdown files for any deleted cmdlets, and update the module page (_e.g.,_ `AzureRM.Profile.md`) with any added or removed cmdlets.
69+
70+
#### Updating a single markdown file
71+
72+
To update a single markdown file with the changes made to the corresponding cmdlet, use the [`Update-MarkdownHelp`](https://github.com/PowerShell/platyPS/blob/master/docs/Update-MarkdownHelp.md) cmdlet:
73+
74+
```powershell
75+
$PathToModuleManifest = "../../<module>.psd1" # Full path to the module manifest that you have updated
76+
Import-Module -Name $PathToModuleManifest
77+
78+
$PathToMarkdownFile = "../../<cmdlet>.md" # Full path to the markdown file to be updated
79+
Update-MarkdownHelp -Path $PathToMarkdownFile -AlphabeticParamsOrder
80+
```
81+
82+
#### Generating and viewing the MAML help
83+
84+
During the build, the MAML help will be generated from the markdown files in the repository. If you would like to generate the MAML help and preview what the help content will look like for each of your cmdlets, you can do so with two more commands.
85+
86+
To generate the MAML help based on the contents of your markdown files, use the [`New-ExternalHelp`](https://github.com/PowerShell/platyPS/blob/master/docs/New-ExternalHelp.md) cmdlet:
87+
88+
```powershell
89+
$PathToHelpFolder = "../../help" # Full path to help folder containing markdown files to be updated
90+
$PathToOutputFolder = "../../.." # Full path to folder where you want the MAML file to be generated
91+
New-ExternalHelp -Path $PathToHelpFolder -OutputPath $PathToOutputFolder
92+
```
93+
94+
To preview the help that you just generated, use the [`Get-HelpPreview`](https://github.com/PowerShell/platyPS/blob/master/docs/Get-HelpPreview.md) cmdlet:
95+
96+
```powershell
97+
$PathToMAML = "../../<maml>.dll-Help.xml" # Full path to the MAML file that was generated
98+
99+
# Save the help locally
100+
$help = Get-HelpPreview -Path $PathToMAML
101+
102+
# Get the help for a specific cmdlet
103+
$help | where { $_.Name -eq "<cmdlet>" }
104+
```

0 commit comments

Comments
 (0)