コード例 #1
0
        //
        // Deployment operations
        //
        public async Task BeginRepositoryDeploymentAsync(AssetRepository repository)
        {
            using (var client = await _clientProvider.CreateResourceManagementClient(repository.SubscriptionId))
            {
                await client.ResourceGroups.CreateOrUpdateAsync(
                    repository.ResourceGroupName,
                    new ResourceGroup(
                        repository.Subnet.Location, // The subnet location pins us to a region
                        tags : AzureResourceProvider.GetEnvironmentTags(repository.EnvironmentName)));

                await _azureResourceProvider.AssignRoleToIdentityAsync(
                    repository.SubscriptionId,
                    repository.ResourceGroupResourceId,
                    AzureResourceProvider.ContributorRole,
                    _identityProvider.GetPortalManagedServiceIdentity());

                repository.Deployment = new AzureRenderHub.WebApp.Arm.Deploying.Deployment
                {
                    DeploymentName    = $"{repository.Name}-{Guid.NewGuid()}",
                    SubscriptionId    = repository.SubscriptionId,
                    ResourceGroupName = repository.ResourceGroupName,
                };

                await UpdateRepository(repository);

                await DeployRepository(repository);
            }
        }
コード例 #2
0
        //
        // Deployment operations
        //
        public async Task BeginRepositoryDeploymentAsync(AssetRepository repository, IManagementClientProvider managementClientProvider, IAzureResourceProvider azureResourceProvider)
        {
            using (var client = await managementClientProvider.CreateResourceManagementClient(repository.SubscriptionId))
            {
                await client.ResourceGroups.CreateOrUpdateAsync(
                    repository.ResourceGroupName,
                    new ResourceGroup(
                        repository.Subnet.Location, // The subnet location pins us to a region
                        tags : AzureResourceProvider.GetEnvironmentTags(repository.EnvironmentName)));

                await azureResourceProvider.AssignManagementIdentityAsync(
                    repository.SubscriptionId,
                    repository.ResourceGroupResourceId,
                    AzureResourceProvider.ContributorRole,
                    _identityProvider.GetPortalManagedServiceIdentity());

                repository.DeploymentName = "FileServerDeployment";
                await UpdateRepository(repository);

                await DeployFileServer(repository as NfsFileServer, managementClientProvider);
            }
        }