File tree Expand file tree Collapse file tree 2 files changed +26
-11
lines changed
src/ResourceManager/Common/Commands.Common.Strategies Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,20 @@ public static ResourceConfig<NetworkSecurityGroup> CreateNetworkSecurityGroupCon
2323 name ,
2424 _ => new NetworkSecurityGroup
2525 {
26- SecurityRules = new SecurityRule [ ]
27- {
28- new SecurityRule
26+ SecurityRules = openPorts
27+ . Select ( ( port , index ) => new SecurityRule
2928 {
30- DestinationPortRanges = openPorts . Select ( v => v . ToString ( ) ) . ToList ( )
31- }
32- }
29+ Name = name + port ,
30+ Protocol = "Tcp" ,
31+ Priority = index + 1000 ,
32+ Access = "Allow" ,
33+ Direction = "Inbound" ,
34+ SourcePortRange = "*" ,
35+ SourceAddressPrefix = "*" ,
36+ DestinationPortRange = port . ToString ( ) ,
37+ DestinationAddressPrefix = "*"
38+ } )
39+ . ToList ( )
3340 } ) ;
3441 }
3542}
Original file line number Diff line number Diff line change 1- using System . Linq ;
1+ using System ;
2+ using System . Linq ;
23using System . Threading ;
34using System . Threading . Tasks ;
45
@@ -48,10 +49,17 @@ await _OperationContext.GetOrAdd(
4849 . Select ( UpdateStateAsyncDispatch ) ;
4950 await Task . WhenAll ( tasks ) ;
5051 // call the CreateOrUpdateAsync function for the resource.
51- return await config . CreateOrUpdateAsync (
52- _OperationContext . Client ,
53- model ,
54- _OperationContext . CancellationToken ) ;
52+ try
53+ {
54+ return await config . CreateOrUpdateAsync (
55+ _OperationContext . Client ,
56+ model ,
57+ _OperationContext . CancellationToken ) ;
58+ }
59+ catch ( Exception e )
60+ {
61+ throw e ;
62+ }
5563 } ) ;
5664 }
5765 }
You can’t perform that action at this time.
0 commit comments