jeffhollan / LogicAppTemplateCreator

Script to convert Logic Apps into templates for deployment
MIT License
143 stars 74 forks source link

Start on the external help implementation #56

Closed Splaxi closed 4 years ago

Splaxi commented 5 years ago

Implement basic external help support.

Contains a PowerShell helper script file, to be used by hand, when you want to generate new MAML files for the project.

Implemented a post build event, to copy said MAML file, to the output directory, so we can test the external help while loading the module

Documented the current version of Get-LogicAppTemplate,

Current output from Get-Help


NAME
    Get-LogicAppTemplate

SYNTAX
    Get-LogicAppTemplate -LogicApp <string> -ResourceGroup <string> -SubscriptionId <string> [-TenantName <string>] 
    [-Token <string>] [-ClaimsDump <string>] [-DebugOutPutFolder <string>] [-DiagnosticSettings <bool>]  
    [<CommonParameters>]

PARAMETERS
    -ClaimsDump <string>
        Piped input from armclient

        Required?                    false
        Position?                    Named
        Accept pipeline input?       true (ByValue)
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    -DebugOutPutFolder <string>
        If set, result from rest interface will be saved to this folder

        Required?                    false
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    -DiagnosticSettings <bool>
        If true, diagnostic settings will be included in the ARM template

        Required?                    false
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    -LogicApp <string>
        Name of the Logic App

        Required?                    true
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    -ResourceGroup <string>
        Name of the Resource Group

        Required?                    true
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    -SubscriptionId <string>
        The SubscriptionId

        Required?                    true
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    -TenantName <string>
        Name of the Tenant i.e. contoso.onmicrosoft.com

        Required?                    false
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    -Token <string>
        A Bearer token value

        Required?                    false
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           (All)
        Aliases                      None
        Dynamic?                     false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see 
        about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS
    System.String

OUTPUTS
    System.Object

ALIASES
    None

REMARKS
    None

Get-Help after this implementation


NAME
    Get-LogicAppTemplate

SYNOPSIS
    Generate LogicApp ARM template

SYNTAX
    Get-LogicAppTemplate [-ClaimsDump <String>] [-DebugOutPutFolder <String>] [-DiagnosticSettings <Boolean>] 
    -LogicApp <String> -ResourceGroup <String> -SubscriptionId <String> [-TenantName <String>] [-Token <String>] 
    [<CommonParameters>]

DESCRIPTION
    Generate a valid ARM template from a LogicApp directly from the Azure Portal

PARAMETERS
    -ClaimsDump <String>
        Piped input from armclient

        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       True (ByValue)
        Accept wildcard characters?  false

    -DebugOutPutFolder <String>
        If set, result from rest interface will be saved to this folder

        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -DiagnosticSettings <Boolean>
        Instructs the cmdlet to included diagnostic in the ARM template

        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -LogicApp <String>
        Name of the Logic App

        Required?                    true
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -ResourceGroup <String>
        Name of the Resource Group where the Logic App is stored

        Required?                    true
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -SubscriptionId <String>
        The SubscriptionId that the resource group is located in

        Required?                    true
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -TenantName <String>
        Name of the Tenant that the subscription exists in

        This parameter is important when you are trying to access a Logic App from another Azure AD (AAD) tenant than 
        your own primary AAD tenant

        E.g. "contoso.onmicrosoft.com"

        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -Token <String>
        A valied bearer token used to authenticate against the Azure Portal

        The value must only be the raw token and NOT contain the "Bearer " part of a token

        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       False
        Accept wildcard characters?  false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see 
        about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS
    System.String

OUTPUTS
    System.Object

NOTES

        If you want to avoid signing into the Azure Portal, you could spend some time on getting familiar with the 
        ARMClient project.
        This will enable you to get a valid token for your personal user account.

        https://github.com/projectkudu/ARMClient

    -------------------------- Example 1 --------------------------

    PS C:\> Get-LogicAppTemplate -LogicApp "AwesomeLogicApp" -ResourceGroup "LogicAppsDEV" -SubscriptionId 
    "5c92054d-fab6-4dd7-9195-15cd935fa0a4"

    This will connect to the Azure Portal, ask for your credentails like you are used to.
    It will switch context to the supplied subscription id ("5c92054d-fab6-4dd7-9195-15cd935fa0a4").
    The subscription must exists in your default / standard AAD.
    It will located the "LogicAppsDEV" ressource group.
    Inside the ressource group it will locate the "AwesomeLogicApp" logic app.

    The cmdlet will output the entire json string to the pipeline / console.
    -------------------------- Example 2 --------------------------

    PS C:\> Get-LogicAppTemplate -LogicApp "AwesomeLogicApp" -ResourceGroup "LogicAppsDEV" -SubscriptionId 
    "5c92054d-fab6-4dd7-9195-15cd935fa0a4" | Out-File -FilePath "c:\temp\AwesomeLogicApp.json" -Encoding utf8

    This will connect to the Azure Portal, ask for your credentails like you are used to.
    It will switch context to the supplied subscription id ("5c92054d-fab6-4dd7-9195-15cd935fa0a4").
    The subscription must exists in your default / standard AAD.
    It will located the "LogicAppsDEV" ressource group.
    Inside the ressource group it will locate the "AwesomeLogicApp" logic app.

    The output from Get-LogicAppTemplate is piped to Out-File.
    The file will saved to "c:\temp\AwesomeLogicApp.json".
    The file is saved with utf8 encoding.
    -------------------------- Example 3 --------------------------

    PS C:\> Get-LogicAppTemplate -LogicApp "AwesomeLogicApp" -ResourceGroup "LogicAppsDEV" -SubscriptionId 
    "5c92054d-fab6-4dd7-9195-15cd935fa0a4" -TenantName "contoso.onmicrosoft.com"

    This will connect to the Azure Portal, ask for your credentails like you are used to.
    It will use the "contoso.onmicrosoft.com" as the tenant name while looking for the subscriptionId.
    It will switch context to the supplied subscription id ("5c92054d-fab6-4dd7-9195-15cd935fa0a4").
    The subscription must exists in your default / standard AAD.
    It will located the "LogicAppsDEV" ressource group.
    Inside the ressource group it will locate the "AwesomeLogicApp" logic app.

    The cmdlet will output the entire json string to the pipeline / console.
    -------------------------- Example 4 --------------------------

    PS C:\> Get-LogicAppTemplate -LogicApp "AwesomeLogicApp" -ResourceGroup "LogicAppsDEV" -SubscriptionId 
    "5c92054d-fab6-4dd7-9195-15cd935fa0a4" -Token "eyJ0eXAi......."

    This will connect to the Azure Portal, and use the provided token to authenticate to gain access. It will switch 
    context to the supplied subscription id ("5c92054d-fab6-4dd7-9195-15cd935fa0a4").
    The subscription must exists in your default / standard AAD.
    It will located the "LogicAppsDEV" ressource group.
    Inside the ressource group it will locate the "AwesomeLogicApp" logic app.

    The cmdlet will output the entire json string to the pipeline / console.

RELATED LINKS