你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Network Security Perimeter Access Rules - Create Or Update

Creates or updates a network access rule.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}?api-version=2025-01-01

URI Parameters

Name In Required Type Description
accessRuleName
path True

string

maxLength: 80
pattern: (^[a-zA-Z0-9]+[a-zA-Z0-9_.-]*[a-zA-Z0-9_]+$)|(^[a-zA-Z0-9]$)

The name of the NSP access rule.

networkSecurityPerimeterName
path True

string

maxLength: 80
pattern: (^[a-zA-Z0-9]+[a-zA-Z0-9_.-]*[a-zA-Z0-9_]+$)|(^[a-zA-Z0-9]$)

The name of the network security perimeter.

profileName
path True

string

maxLength: 80
pattern: (^[a-zA-Z0-9]+[a-zA-Z0-9_.-]*[a-zA-Z0-9_]+$)|(^[a-zA-Z0-9]$)

The name of the NSP profile.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Client API version.

Request Body

Name Type Description
properties.addressPrefixes

string[]

Inbound address prefixes (IPv4/IPv6)

properties.direction

AccessRuleDirection

Direction that specifies whether the access rules is inbound/outbound.

properties.emailAddresses

string[]

Outbound rules in email address format. This access rule type is currently unavailable for use.

properties.fullyQualifiedDomainNames

string[]

Outbound rules in fully qualified domain name format.

properties.phoneNumbers

string[]

Outbound rules in phone number format. This access rule type is currently unavailable for use.

properties.serviceTags

string[]

Inbound rules of type service tag. This access rule type is currently unavailable for use.

properties.subscriptions

SubscriptionId[]

List of subscription ids

Responses

Name Type Description
200 OK

NspAccessRule

Updated - Existing access rule is updated. Returns the resource.

201 Created

NspAccessRule

Create - Returns the NspAccessRule resource created.

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

NspAccessRulePut

Sample request

PUT https://management.azure.com/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityPerimeters/nsp1/profiles/profile1/accessRules/accessRule1?api-version=2025-01-01

{
  "properties": {
    "direction": "Inbound",
    "addressPrefixes": [
      "10.11.0.0/16",
      "10.10.1.0/24"
    ]
  }
}

Sample response

{
  "name": "accessRule1",
  "id": "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityPerimeters/nsp1/profiles/profile1/accessRules/accessRule1",
  "type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules",
  "properties": {
    "provisioningState": "Succeeded",
    "direction": "Inbound",
    "addressPrefixes": [
      "10.11.0.0/16",
      "10.10.1.0/24"
    ],
    "fullyQualifiedDomainNames": [],
    "subscriptions": [],
    "networkSecurityPerimeters": [],
    "emailAddresses": [],
    "phoneNumbers": [],
    "serviceTags": []
  },
  "systemData": {
    "createdBy": "user",
    "createdByType": "User",
    "createdAt": "2024-02-07T18:07:36.3446713Z",
    "lastModifiedBy": "user",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2024-02-07T18:07:36.3446713Z"
  }
}
{
  "name": "accessRule1",
  "id": "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityPerimeters/nsp1/profiles/profile1/accessRules/accessRule1",
  "type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules",
  "properties": {
    "provisioningState": "Succeeded",
    "direction": "Inbound",
    "addressPrefixes": [
      "10.11.0.0/16",
      "10.10.1.0/24"
    ],
    "fullyQualifiedDomainNames": [],
    "subscriptions": [],
    "networkSecurityPerimeters": [],
    "emailAddresses": [],
    "phoneNumbers": [],
    "serviceTags": []
  },
  "systemData": {
    "createdBy": "user",
    "createdByType": "User",
    "createdAt": "2024-02-07T18:07:36.3446713Z",
    "lastModifiedBy": "user",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2024-02-07T18:07:36.3446713Z"
  }
}

Definitions

Name Description
AccessRuleDirection

Direction that specifies whether the access rules is inbound/outbound.

CloudError

An error response from the service.

CloudErrorBody

An error response from the service.

createdByType

The type of identity that created the resource.

NspAccessRule

The NSP access rule resource

nspProvisioningState

The provisioning state of the scope assignment resource.

PerimeterBasedAccessRule
SubscriptionId
systemData

Metadata pertaining to creation and last modification of the resource.

AccessRuleDirection

Direction that specifies whether the access rules is inbound/outbound.

Value Description
Inbound
Outbound

CloudError

An error response from the service.

Name Type Description
error

CloudErrorBody

Cloud error body.

CloudErrorBody

An error response from the service.

Name Type Description
code

string

An identifier for the error. Codes are invariant and are intended to be consumed programmatically.

details

CloudErrorBody[]

A list of additional details about the error.

message

string

A message describing the error, intended to be suitable for display in a user interface.

target

string

The target of the particular error. For example, the name of the property in error.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

NspAccessRule

The NSP access rule resource

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

The name of the resource

properties.addressPrefixes

string[]

Inbound address prefixes (IPv4/IPv6)

properties.direction

AccessRuleDirection

Direction that specifies whether the access rules is inbound/outbound.

properties.emailAddresses

string[]

Outbound rules in email address format. This access rule type is currently unavailable for use.

properties.fullyQualifiedDomainNames

string[]

Outbound rules in fully qualified domain name format.

properties.networkSecurityPerimeters

PerimeterBasedAccessRule[]

Rule specified by the perimeter id.

properties.phoneNumbers

string[]

Outbound rules in phone number format. This access rule type is currently unavailable for use.

properties.provisioningState

nspProvisioningState

The provisioning state of the scope assignment resource.

properties.serviceTags

string[]

Inbound rules of type service tag. This access rule type is currently unavailable for use.

properties.subscriptions

SubscriptionId[]

List of subscription ids

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

nspProvisioningState

The provisioning state of the scope assignment resource.

Value Description
Succeeded
Creating
Updating
Deleting
Accepted
Failed

PerimeterBasedAccessRule

Name Type Description
id

string (arm-id)

NSP id in the ARM id format.

location

string

Location of the NSP supplied.

perimeterGuid

string

Resource guid of the NSP supplied.

SubscriptionId

Name Type Description
id

string (arm-id)

Subscription id in the ARM id format.

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.