Updated: April 15, 2015
The NetworkTrafficRules node is an optional element in the service definition file that specifies how roles communicate with each other. It limits which roles can access the internal endpoints of the specific role. The NetworkTrafficRules is not a standalone element; it is combined with two or more roles in a service definition file.
The default extension for the service definition file is .csdef.
The NetworkTrafficRules node is only available using the Azure SDK version 1.3 or higher.
The basic format of a service definition file containing network traffic definitions is as follows.
<ServiceDefinition …> <NetworkTrafficRules> <OnlyAllowTrafficTo > <Destinations> <RoleEndpoint endpointName="<name-of-the-endpoint>" roleName="<name-of-the-role-containing-the-endpoint>"/> </Destinations> <AllowAllTraffic/> <WhenSource matches="[AnyRule]"> <FromRole roleName="<name-of-the-role-to-allow-traffic-from>"/> </WhenSource> </OnlyAllowTrafficTo> </NetworkTrafficRules> </ServiceDefinition>
The NetworkTrafficRules element specifies which roles can communicate with which endpoint on another role. A service can contain one NetworkTrafficRules definition.
The OnlyAllowTrafficTo element describes a collection of destination endpoints and the roles that can communicate with them. You can specify multiple OnlyAllowTrafficTo nodes.
The Destinations element describes a collection of RoleEndpoints than can be communicated with.
The RoleEndpoint element describes an endpoint on a role to allow communications with. You can specify multiple RoleEndpoint elements if there are more than one endpoint on the role.
Required. The name of the endpoint to allow traffic to.
Required. The name of the web role to allow communication to.
The AllowAllTraffic element is a rule that allows all roles to communicate with the endpoints defined in the Destinations node.
The WhenSource element describes a collection of roles than can communicate with the endpoints defined in the Destinations node.
Required. Specifies the rule to apply when allowing communications. The only valid value is currently AnyRule.
The FromRole element specifies the roles that can communicate with the endpoints defined in the Destinations node. You can specify multiple FromRole elements if there are more than one role that can communicate with the endpoints.
Required. The name for role from which to allow communication.