# AzureSecurityRule

- Module: [Aspire.Hosting.Azure.Network](/reference/api/go/aspire.hosting.azure.network.md)
- Version: `17.0.0`
- Kind: `struct`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Represents a security rule configuration for an Azure Network Security Group.

## Remarks

Security rules control inbound and outbound network traffic for subnets associated with the Network Security Group.
Rules are evaluated in priority order, with lower numbers having higher priority.

## Definition

```go
type AzureSecurityRule struct {
    Name                              string                `json:"Name"`
    Description                       *string               `json:"Description"`
    Priority                          float64               `json:"Priority"`
    Direction                         SecurityRuleDirection `json:"Direction"`
    Access                            SecurityRuleAccess    `json:"Access"`
    Protocol                          SecurityRuleProtocol  `json:"Protocol"`
    SourceAddressPrefix               string                `json:"SourceAddressPrefix"`
    SourceAddressPrefixReference      *ReferenceExpression  `json:"SourceAddressPrefixReference"`
    SourcePortRange                   string                `json:"SourcePortRange"`
    DestinationAddressPrefix          string                `json:"DestinationAddressPrefix"`
    DestinationAddressPrefixReference *ReferenceExpression  `json:"DestinationAddressPrefixReference"`
    DestinationPortRange              string                `json:"DestinationPortRange"`
}
```

## Fields

- `Name`: `string` -- Gets or sets the name of the security rule. This name must be unique within the Network Security Group.
- `Description`: `*string` -- Gets or sets an optional description for the security rule.
- `Priority`: `float64` -- Gets or sets the priority of the rule. Valid values are between 100 and 4096. Lower numbers have higher priority.
- `Direction`: `SecurityRuleDirection` -- Gets or sets the direction of the rule.
- `Access`: `SecurityRuleAccess` -- Gets or sets whether network traffic is allowed or denied.
- `Protocol`: `SecurityRuleProtocol` -- Gets or sets the network protocol this rule applies to.
- `SourceAddressPrefix`: `string` -- Gets or sets the source address prefix. Defaults to "*" (any).
- `SourceAddressPrefixReference`: `*ReferenceExpression` -- Gets or sets a `ReferenceExpression` whose value is resolved at deploy time and used as the source address prefix for the rule. Takes precedence over `SourceAddressPrefix`.
- `SourcePortRange`: `string` -- Gets or sets the source port range. Defaults to "*" (any).
- `DestinationAddressPrefix`: `string` -- Gets or sets the destination address prefix. Defaults to "*" (any).
- `DestinationAddressPrefixReference`: `*ReferenceExpression` -- Gets or sets a `ReferenceExpression` whose value is resolved at deploy time and used as the destination address prefix for the rule. Takes precedence over `DestinationAddressPrefix`.
- `DestinationPortRange`: `string` -- Gets or sets the destination port range. Use "*" for any, or a range like "80-443".
