# AzureSecurityRule Properties

- Package: [Aspire.Hosting.Azure.Network](/reference/api/csharp/aspire.hosting.azure.network.md)
- Type: [AzureSecurityRule](/reference/api/csharp/aspire.hosting.azure.network/azuresecurityrule.md)
- Kind: `Properties`
- Members: `12`

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

## Access

- Name: `Access`
- Modifiers: `get; set`
- Returns: `SecurityRuleAccess`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets whether network traffic is allowed or denied.

```csharp
public SecurityRuleAccess Access { get; set; }
```

## Description

- Name: `Description`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets an optional description for the security rule.

```csharp
public string? Description { get; set; }
```

## DestinationAddressPrefix

- Name: `DestinationAddressPrefix`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the destination address prefix. Defaults to "*" (any).

```csharp
public string DestinationAddressPrefix { get; set; }
```

## DestinationAddressPrefixReference

- Name: `DestinationAddressPrefixReference`
- Modifiers: `nullable` `get; set`
- Returns: `ReferenceExpression?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets a `ApplicationModel.ReferenceExpression` whose value is resolved at deploy time and used as the destination address prefix for the rule. Takes precedence over [AzureSecurityRule.DestinationAddressPrefix](/reference/api/csharp/aspire.hosting.azure.network/azuresecurityrule/properties.md#destinationaddressprefix).

```csharp
public ReferenceExpression? DestinationAddressPrefixReference { get; set; }
```

## DestinationPortRange

- Name: `DestinationPortRange`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the destination port range. Use "*" for any, or a range like "80-443".

```csharp
public string DestinationPortRange { get; set; }
```

## Direction

- Name: `Direction`
- Modifiers: `get; set`
- Returns: `SecurityRuleDirection`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the direction of the rule.

```csharp
public SecurityRuleDirection Direction { get; set; }
```

## Name

- Name: `Name`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the name of the security rule. This name must be unique within the Network Security Group.

```csharp
public string Name { get; set; }
```

## Priority

- Name: `Priority`
- Modifiers: `get; set`
- Returns: `int`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the priority of the rule. Valid values are between 100 and 4096. Lower numbers have higher priority.

```csharp
public int Priority { get; set; }
```

## Protocol

- Name: `Protocol`
- Modifiers: `get; set`
- Returns: `SecurityRuleProtocol`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the network protocol this rule applies to.

```csharp
public SecurityRuleProtocol Protocol { get; set; }
```

## SourceAddressPrefix

- Name: `SourceAddressPrefix`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the source address prefix. Defaults to "*" (any).

```csharp
public string SourceAddressPrefix { get; set; }
```

## SourceAddressPrefixReference

- Name: `SourceAddressPrefixReference`
- Modifiers: `nullable` `get; set`
- Returns: `ReferenceExpression?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets a `ApplicationModel.ReferenceExpression` whose value is resolved at deploy time and used as the source address prefix for the rule. Takes precedence over [AzureSecurityRule.SourceAddressPrefix](/reference/api/csharp/aspire.hosting.azure.network/azuresecurityrule/properties.md#sourceaddressprefix).

```csharp
public ReferenceExpression? SourceAddressPrefixReference { get; set; }
```

## SourcePortRange

- Name: `SourcePortRange`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.Network/AzureSecurityRule.cs)

Gets or sets the source port range. Defaults to "*" (any).

```csharp
public string SourcePortRange { get; set; }
```
