< Back

Add-GceFirewall

Mon Jan 13, 2020 10:57 pm

NAME Add-GceFirewall



SYNOPSIS

Adds a new firewall rule.





SYNTAX

Add-GceFirewall [-Project <string>] [-Name] <string> -AllowedProtocol <List`1> [-Description <string>] [-Network

<string>] [-SourceRange <List`1>] [-SourceTag <List`1>] [-TargetTag <List`1>] [<CommonParameters>]





DESCRIPTION

Adds a new firewall rule. When given a pipeline of many Firewall.AllowedData, will collect them all and create a

single new firewall rule.





PARAMETERS

-Project <string>

The name of the project to add the firewall rule to.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <string>

The name of the new firewall rule.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AllowedProtocol <List`1>

A list of allowed protocols and ports. you can use New-GceFirewallProtocol to create them.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Allowed <List`1>

A list of allowed protocols and ports. you can use New-GceFirewallProtocol to create them.



This is an alias of the AllowedProtocol parameter.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Protocol <List`1>

A list of allowed protocols and ports. you can use New-GceFirewallProtocol to create them.



This is an alias of the AllowedProtocol parameter.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Description <string>

The human readable description of this firewall rule.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Network <string>

Url of the network resource for this firewall rule. If empty will be the default network.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SourceRange <List`1>

The IP address block that this rule applies to, expressed in CIDR format. One or both of SourceRange and

SourceTag may be set. If both parameters are set, an inbound connection is allowed if it matches either

SourceRange or SourceTag.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SourceTag <List`1>

The instance tag which this rule applies to. One or both of SourceRange and SourceTag may be set. If both

parameters are set, an inbound connection is allowed it matches either SourceRange or SourceTag. Source tags

cannot be used to allow access to an instance's external IP address. Source tags can only be used to control

traffic traveling from an instance inside the same network as the firewall rule.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TargetTag <List`1>

An instance tag indicating sets of instances located in the network that may make network connections as

specified in allowed[]. If TargetTag is not specified, the firewall rule applies to all instances on the

specified network.



Required? false

Position? named

Default value

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.Collections.Generic.List`1[[Google.Apis.Compute.v1.Data.Firewall+AllowedData, Google.Apis.Compute.v1,

Version=1.29.1.981, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab]]

A list of allowed protocols and ports. you can use New-GceFirewallProtocol to create them.





OUTPUTS

Google.Apis.Compute.v1.Data.Firewall





---------- EXAMPLE 1 ----------



PS C:\\> New-GceFirewallProtocol tcp -Ports 80, 443 |

New-GceFirewallProtocol esp |

Add-GceFirewall -Name "my-firewall" -SourceTag my-source -TargetTag my-target



Creates a new firewall rule in the default project named "my-firewall". The firewall allows traffic using tcp on

ports 80 and 443 as well as the esp protocol from servers tagged my-source to servers tagged my-target.



RELATED LINKS

[Firewall resource definition] (https://cloud.google.com/compute/docs/r ... s#resource)