public async Task <string> Run( [ActivityTrigger] IDurableActivityContext context) { if (context is null) { throw new ArgumentNullException(nameof(context)); } var project = context.GetInput <Input>().Project; var tenantId = await azureSessionService .GetTenantIdAsync() .ConfigureAwait(false); var organization = await organizationRepository .GetAsync(tenantId.ToString(), project.Organization) .ConfigureAwait(false); var deploymentScopes = await deploymentScopeRepository .ListAsync(project.Organization) .Select(scope => scope.Id) .ToArrayAsync() .ConfigureAwait(false); var template = new SharedResourcesTemplate(); template.Parameters["organizationId"] = organization.Id; template.Parameters["organizationName"] = organization.Slug; template.Parameters["organizationTags"] = organization.GetWellKnownTags(); template.Parameters["projectId"] = project.Id; template.Parameters["projectName"] = project.Slug; template.Parameters["projectTags"] = project.GetWellKnownTags(); template.Parameters["deploymentScopes"] = deploymentScopes; var deployment = await azureDeploymentService .DeploySubscriptionTemplateAsync(template, Guid.Parse(organization.SubscriptionId), organization.Location) .ConfigureAwait(false); return(deployment.ResourceId); }
public async Task <string> Run( [ActivityTrigger] IDurableActivityContext context) { if (context is null) { throw new ArgumentNullException(nameof(context)); } var organization = context.GetInput <Input>().Organization; var template = new SharedResourcesTemplate(); template.Parameters["organizationId"] = organization.Id; template.Parameters["organizationName"] = organization.Slug; template.Parameters["organizationTags"] = organization.GetWellKnownTags(); var deployment = await azureDeploymentService .DeploySubscriptionTemplateAsync(template, Guid.Parse(organization.SubscriptionId), organization.Location) .ConfigureAwait(false); return(deployment.ResourceId); }