New-AzPostgreSqlFlexibleServerFirewallRule

Creates a new firewall rule or updates an existing firewall rule.

Syntax

New-AzPostgreSqlFlexibleServerFirewallRule
   -ResourceGroupName <String>
   -ServerName <String>
   [-Name <String>]
   [-SubscriptionId <String>]
   -EndIPAddress <String>
   -StartIPAddress <String>
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzPostgreSqlFlexibleServerFirewallRule
   -ResourceGroupName <String>
   -ServerName <String>
   [-Name <String>]
   [-SubscriptionId <String>]
   -ClientIPAddress <String>
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzPostgreSqlFlexibleServerFirewallRule
   -ResourceGroupName <String>
   -ServerName <String>
   [-Name <String>]
   [-SubscriptionId <String>]
   [-AllowAll]
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Creates a new firewall rule or updates an existing firewall rule.

Examples

Example 1: Create a new PostgreSql server Firewall Rule

New-AzPostgreSqlFlexibleServerFirewallRule -Name firewallrule-test -ResourceGroupName PowershellPostgreSqlTest -ServerName postgresql-test -EndIPAddress 0.0.0.1 -StartIPAddress 0.0.0.0

Name              StartIPAddress EndIPAddress
----------------- -------------- ------------
firewallrule-test 0.0.0.0        0.0.0.1

This cmdlets create a PostgreSql server Firewall Rule.

Example 2: Create a new PostgreSql Firewall Rule using -ClientIPAddress.

New-AzPostgreSqlFlexibleServerFirewallRule -ResourceGroupName PowershellPostgreSqlTest -ServerName postgresql-test -ClientIPAddress 0.0.0.1

Name                                StartIPAddress EndIPAddress
----                                -------------- ------------
ClientIPAddress_2020-08-11_18-19-27 0.0.0.1        0.0.0.1

This cmdlets create a PostgreSql Firewall Rule using -ClientIPAddress.

Example 3: Create a new PostgreSql Firewall Rule to allow all IPs

New-AzPostgreSqlFlexibleServerFirewallRule -ResourceGroupName PowershellPostgreSqlTest -ServerName postgresql-test -AllowAll

Name                         StartIPAddress EndIPAddress
----                         -------------- ------------
AllowAll_2020-08-11_18-19-27 0.0.0.0        255.255.255.255

This cmdlets create a new PostgreSql Firewall Rule to allow all IPs.

Parameters

-AllowAll

Present to allow all range IPs, from 0.0.0.0 to 255.255.255.255.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-AsJob

Run the command as a job

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClientIPAddress

Client specified single IP of the server firewall rule. Must be IPv4 format.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EndIPAddress

The end IP address of the server firewall rule. Must be IPv4 format.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

The name of the server firewall rule. If not specified, the default is undefined. If AllowAll is present, the default name is AllowAll_yyyy-MM-dd_HH-mm-ss.

Type:String
Aliases:FirewallRuleName
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NoWait

Run the command asynchronously

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group. The name is case insensitive.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ServerName

The name of the server.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-StartIPAddress

The start IP address of the server firewall rule. Must be IPv4 format.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

IFirewallRule