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
23
23
name ,
24
24
_ => new NetworkSecurityGroup
25
25
{
26
- SecurityRules = new SecurityRule [ ]
27
- {
28
- new SecurityRule
26
+ SecurityRules = openPorts
27
+ . Select ( ( port , index ) => new SecurityRule
29
28
{
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 ( )
33
40
} ) ;
34
41
}
35
42
}
Original file line number Diff line number Diff line change 1
- using System . Linq ;
1
+ using System ;
2
+ using System . Linq ;
2
3
using System . Threading ;
3
4
using System . Threading . Tasks ;
4
5
@@ -48,10 +49,17 @@ await _OperationContext.GetOrAdd(
48
49
. Select ( UpdateStateAsyncDispatch ) ;
49
50
await Task . WhenAll ( tasks ) ;
50
51
// 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
+ }
55
63
} ) ;
56
64
}
57
65
}
You can’t perform that action at this time.
0 commit comments