Skip to content

Commit

Permalink
NetworkSecurityGroup bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-shandar committed Nov 27, 2017
1 parent c6b0f02 commit b41234e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ public static ResourceConfig<NetworkSecurityGroup> CreateNetworkSecurityGroupCon
name,
_ => new NetworkSecurityGroup
{
SecurityRules = new SecurityRule[]
{
new SecurityRule
SecurityRules = openPorts
.Select((port, index) => new SecurityRule
{
DestinationPortRanges = openPorts.Select(v => v.ToString()).ToList()
}
}
Name = name + port,
Protocol = "Tcp",
Priority = index + 1000,
Access = "Allow",
Direction = "Inbound",
SourcePortRange = "*",
SourceAddressPrefix = "*",
DestinationPortRange = port.ToString(),
DestinationAddressPrefix = "*"
})
.ToList()
});
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -48,10 +49,17 @@ await _OperationContext.GetOrAdd(
.Select(UpdateStateAsyncDispatch);
await Task.WhenAll(tasks);
// call the CreateOrUpdateAsync function for the resource.
return await config.CreateOrUpdateAsync(
_OperationContext.Client,
model,
_OperationContext.CancellationToken);
try
{
return await config.CreateOrUpdateAsync(
_OperationContext.Client,
model,
_OperationContext.CancellationToken);
}
catch (Exception e)
{
throw e;
}
});
}
}
Expand Down

0 comments on commit b41234e

Please sign in to comment.