Skip to content

Add/New-AzLoadBalancerFrontendIpConfig Public IP Prefix Support #12214

@MrCaedes

Description

@MrCaedes

Description of the new feature

Public IP Prefixes are GA, however, do not appear to be supported when attempting to utilise via Add-AzLoadBalancerFrontendIpConfig and New-AzLoadBalancerFrontendIpConfig when setting up (or modifying) a Load Balancer.

This is contrary to the capabilities provided via the Azure Portal, which allows FEC to be setup against the PIPP object - which can then be utilised by Outbound rules without an issue, when manually setup.

Portal Example

Ideally, the aforementioned cmdlets should be updated to allow both Microsoft.Azure.Commands.Network.Models.PSPublicIpPrefix and Microsoft.Azure.Commands.Network.Models.PSPublicIpAddress to be utilised for the -PublicIPAddress flag to bring in-line with the deployments available via the portal (and ARM).

Current Workaround

The current workaround that I've had to resort to is completely cutting out the use of the aforementioned cmdlets, and fudging together the below within my workflow:

$azContext = Get-AzContext
$azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile)
$tokenHeader = @{
    'Content-Type' = 'application/json';
    'Authorization' = 'Bearer ' + ($profileClient.AcquireAccessToken($azContext.Subscription.TenantId)).AccessToken;   
}

$lbConfigEP = 'https://management.azure.com/subscriptions/EXAMPLE/resourceGroups/EXAMPLE/providers/Microsoft.Network/loadBalancers/exampleLb?api-version=2020-05-01'
$currentConfig = Invoke-RestMethod -Method GET -Uri $lbConfigEP -Headers $tokenHeader 
$currentConfig.properties.frontendIPConfigurations += @{
    "name" = "portalExample2";
    "properties" = @{
        "privateIPAllocationMethod" = "Dynamic";
        "publicIPPrefix" = @{
            "id" = "/subscriptions/EXAMPLE/resourceGroups/PPIP_Container/providers/Microsoft.Network/publicIPPrefixes/exampleTest"
        }
    }
}

$updatedConfig = Invoke-RestMethod -Method PUT -Uri $lbConfigEP -Headers $tokenHeader -Body ($currentConfig | ConvertTo-JSON -Depth 100)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Network - Load BalancerService AttentionThis issue is responsible by Azure service team.customer-reportedneeds-author-feedbackMore information is needed from author to address the issue.needs-team-triagequestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions