question

Sara-8613 avatar image
0 Votes"
Sara-8613 asked ChaitanyaNaykodiMSFT-9638 commented

Create NSG Rule in Azure using Java

I am trying to create NSG Rules in Microsoft Azure using their API, does anyone know if this is fine to create a Rule?

 NetworkSecurityGroup.Update update = networkSecurityGroup.update();
 update.defineRule(name)
                         .allowInbound()
                         .fromAddresses("")
                         .fromPortRanges()
                         .toAddresses("")
                         .toPortRanges("")
                         .withProtocol(SecurityRuleProtocol.UDP)
                         .withPriority(ruleRepresentation.getPriority())
                         .attach();
azure-virtual-network
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Sara-8613, Thank you for reaching out and apologies for delayed response here.
Have you considered about using management API in this case? You can perform the API call via code to create or update NSG and NSG rules.
Regarding Azure Java SDK have you explored the SecurityRulesClient Interface?


0 Votes 0 ·

0 Answers