public ResourceManagementHelper(Configuration configuration, AcquireTokenResult acquireTokenResult) { _configuration = configuration; _accessToken = acquireTokenResult.AccessToken; _azureCredentials = new AzureCredentials( new TokenCredentials(acquireTokenResult.AccessToken), new TokenCredentials(acquireTokenResult.AccessToken), configuration.TenantId, AzureEnvironment.AzureGlobalCloud); _currentUserObjectId = acquireTokenResult.UserObjectId; }
public static async Task Main() { var configuration = ReadConfiguration(); AcquireTokenResult acquireTokenResult = await new AuthenticationHelper(configuration.ClientId, configuration.TenantId, AuthenticationHelper.AzureManagementScopes).AcquireTokenAsync(); await new ResourceManagementHelper(configuration, acquireTokenResult).CreateAzureResourcesAsync(false); acquireTokenResult = await new AuthenticationHelper(configuration.ClientId, configuration.TenantId, AuthenticationHelper.KeyVaultScopes).AcquireTokenAsync(); var certificate = await new RootCertificateHelper(configuration, acquireTokenResult.AccessToken).GenerateRootCertificate(); await WriteCertificateToFile(certificate); }