public async Task <bool> DeployPrivateDnsZoneGroupsArmTemplate([ActivityTrigger] DeployPrivateDnsZoneGroupsArmTemplateParameters parameters, ILogger log) { var privateEndpointResourceGroupName = Constants.ResourceGroupCaptureRegEx.Match(parameters.PrivateEndpointResourceId).Groups["resourcegroup"].Value; var privateEndpointName = Constants.PrivateEndpointCaptureRegEx.Match(parameters.PrivateEndpointResourceId).Groups["privateEndpoint"].Value; var privateDnsZoneResourceId = privateDnsManagementService.GetPrivateDnsZoneResourceId(parameters.PrivateDnsZone); resourceManagementService.SetSubscriptionId(parameters.SubscriptionId); return(await resourceManagementService.CreatePrivateDnsZoneGroupsDeploymentAsync(privateEndpointResourceGroupName, privateEndpointName, privateDnsZoneResourceId)); }
public async Task <bool> OrchestratePrivateEndpointCreatedAsync([OrchestrationTrigger] IDurableOrchestrationContext context) { var orchestratorParameters = context.GetInput <OrchestratorParameters>(); // Get Private Endpoint that was just created. var privateEndpoint = await context.CallActivityAsync <PrivateEndpoint>(nameof(GetPrivateEndpointAsync), orchestratorParameters); var addedDnsZones = new HashSet <string>(); foreach (var privateLinkServiceConnection in privateEndpoint.PrivateLinkServiceConnections) { foreach (var key in privateLinkServiceConnection.PrivateLinkServiceId.ToPrivateDnsZoneLookupKeys(privateLinkServiceConnection.GroupIds)) { var privateDnsZoneMapping = Constants.ZoneMapping.SingleOrDefault(s => s.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); var privateDnsZone = string.Format(privateDnsZoneMapping.Value, privateEndpoint.Location.ToLower()); if (!addedDnsZones.Contains(privateDnsZone)) { var deployParameters = new DeployPrivateDnsZoneGroupsArmTemplateParameters { SubscriptionId = orchestratorParameters.SubscriptionId, PrivateEndpointResourceId = orchestratorParameters.ResourceId, PrivateDnsZone = privateDnsZone }; if (!await context.CallActivityAsync <bool>(nameof(DeployPrivateDnsZoneGroupsArmTemplate), deployParameters)) { return(false); } addedDnsZones.Add(privateDnsZone); } } } return(true); }