summary import { ServiceEndpointPolicy , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function createServiceEndpointPolicyWithDefinition ( ) { const subscriptionId = "subid" ; const resourceGroupName = "rg1" ; const serviceEndpointPolicyName = "testPolicy" ; const parameters = { location : "westus" , serviceEndpointPolicyDefinitions : [ { name : "StorageServiceEndpointPolicyDefinition" , description : "Storage Service EndpointPolicy Definition" , service : "Microsoft.Storage" , serviceResources : [ "/subscriptions/subid1" , "/subscriptions/subid1/resourceGroups/storageRg" , "/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount" ] } ] } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . serviceEndpointPolicies . beginCreateOrUpdateAndWait ( resourceGroupName , serviceEndpointPolicyName , parameters ) ; console . log ( result ) ; } createServiceEndpointPolicyWithDefinition ( ) . catch ( console . error ) ;