Azure / Azure/azure-powershell

Generated Az.Functions.psd1 should populate `ScriptsToProcess` and `FunctionsToExport`

Open
#11,367 1 comment 0 reactions 2 assignees Claimed by @dolauli View on GitHub
Azure PS Team Generator potential-pruning
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

When building the Az.Functions module, the generated `Az.Functions.psd1` adds all the functions defined in HelperFunctions.ps1 to `CmdletsToExport` when it should not. In addition, the generated psd1 does not include an entry for `ScriptsToProcess = './custom/HelperFunctions.ps1'. `

For reference, please see PR: https://github.com/Azure/azure-powershell/pull/11232.

Here is the generated psd1:
```powershell
@{
GUID = 'eafced71-8742-4a2c-5afd-13117428dd90'
RootModule = './Az.Functions.psm1'
ModuleVersion = '0.0.2'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell - Azure Functions service cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.

For information on Azure Functions, please visit the following: https://docs.microsoft.com/azure/azure-functions/'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Functions.private.dll'
FormatsToProcess = './Az.Functions.format.ps1xml', './custom/Functions.format.ps1xml'
CmdletsToExport = 'AddFunctionAppPlanWorkerType', 'AddFunctionAppSettings', 'CreateFunctionsIdentity', 'GetApplicationInsightsProject', 'Get-AzFunctionApp', 'Get-AzFunctionAppAvailableLocation', 'Get-AzFunctionAppPlan', 'GetConnectionString', 'GetDefaultOSType', 'GetDefaultRuntimeVersion', 'GetErrorMessage', 'GetFunctionAppPlans', 'GetFunctionApps', 'GetLinuxFxVersion', 'GetServicePlan', 'GetSkuName', 'GetStorageAccount', 'GetSupportedRuntimes', 'GetWorkerVersion', 'NewAppSetting', 'New-AzFunctionApp', 'New-AzFunctionAppPlan', 'NormalizeSku', 'ParseDockerImage', 'Remove-AzFunctionApp', 'Remove-AzFunctionAppPlan', 'Restart-AzFunctionApp', 'Set-AzFunctionAppPlan', 'Start-AzFunctionApp', 'Stop-AzFunctionApp', 'Test-Az', 'ThrowTerminatingError', 'ValidateConsumptionPlanLocation', 'ValidateFunctionName', 'ValidateLocation', 'ValidateRuntimeAndRuntimeVersion', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Functions'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
Profiles = 'latest-2019-04-30', 'hybrid-2019-03-01'
}
}
}

```

Manually edited version (which is the desired version):
In here I used `FunctionsToExport` instead of `CmdletsToExport` with the name of the customer facing cmdlets only, and I added an entry for `ScriptsToProcess = './custom/HelperFunctions.ps1'`

```powershell
@{
GUID = 'eafced71-8742-4a2c-5afd-13117428dd90'
RootModule = './Az.Functions.psm1'
ModuleVersion = '0.0.2'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell - Azure Functions service cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.

For information on Azure Functions, please visit the following: https://docs.microsoft.com/azure/azure-functions/'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Functions.private.dll'
FormatsToProcess = './Az.Functions.format.ps1xml', './custom/Functions.format.ps1xml'
TypesToProcess = './custom/Functions.types.ps1xml'
ScriptsToProcess = './custom/HelperFunctions.ps1'
FunctionsToExport = 'Get-AzFunctionApp', 'Get-AzFunctionAppAvailableLocation', 'Get-AzFunctionAppPlan', 'New-AzFunctionApp', 'New-AzFunctionAppPlan', 'Remove-AzFunctionApp', 'Remove-AzFunctionAppPlan', 'Restart-AzFunctionApp', 'Start-AzFunctionApp', 'Stop-AzFunctionApp'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Functions'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
Profiles = 'latest-2019-04-30', 'hybrid-2019-03-01'
}
}
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.