public async void TestDatabaseBlobAuditingPolicy() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { ResourceGroup resourceGroup = context.CreateResourceGroup(); SqlManagementClient client = context.GetClient <SqlManagementClient>(); Server server = context.CreateServer(resourceGroup); Database database = client.Databases.CreateOrUpdate(resourceGroup.Name, server.Name, SqlManagementTestUtilities.GenerateName(DatabaseNamePrefix), new Database() { Location = server.Location, }); Assert.NotNull(database); StorageAccountInformation storageAccountInformation = await CreateStorageAccountAsync(context, resourceGroup); DatabaseBlobAuditingPolicy databasePolicy = new DatabaseBlobAuditingPolicy { State = BlobAuditingPolicyState.Enabled, StorageEndpoint = storageAccountInformation.Endpoint, StorageAccountAccessKey = storageAccountInformation.PrimaryKey, RetentionDays = RetentionDays, IsStorageSecondaryKeyInUse = IsStorageSecondaryKeyInUse, IsAzureMonitorTargetEnabled = true, QueueDelayMs = 1000 }; ExtendedDatabaseBlobAuditingPolicy extendedDatabasePolicy = new ExtendedDatabaseBlobAuditingPolicy { State = BlobAuditingPolicyState.Enabled, StorageEndpoint = storageAccountInformation.Endpoint, StorageAccountAccessKey = storageAccountInformation.PrimaryKey, RetentionDays = RetentionDays, IsStorageSecondaryKeyInUse = IsStorageSecondaryKeyInUse, PredicateExpression = PredicateExpression, IsAzureMonitorTargetEnabled = true, QueueDelayMs = 1000 }; DatabaseBlobAuditingPolicy databaseResultPolicy = await client.DatabaseBlobAuditingPolicies.CreateOrUpdateAsync(resourceGroup.Name, server.Name, database.Name, databasePolicy); VerifyDatabaseBlobAuditingPolicy(databasePolicy, databaseResultPolicy); databaseResultPolicy = await client.DatabaseBlobAuditingPolicies.GetAsync(resourceGroup.Name, server.Name, database.Name); VerifyDatabaseBlobAuditingPolicy(databasePolicy, databaseResultPolicy); ExtendedDatabaseBlobAuditingPolicy extendedDatabaseResultPolicy = await client.ExtendedDatabaseBlobAuditingPolicies.CreateOrUpdateAsync(resourceGroup.Name, server.Name, database.Name, extendedDatabasePolicy); VerifyExtendedDatabaseBlobAuditingPolicy(extendedDatabasePolicy, extendedDatabaseResultPolicy); extendedDatabaseResultPolicy = await client.ExtendedDatabaseBlobAuditingPolicies.GetAsync(resourceGroup.Name, server.Name, database.Name); VerifyExtendedDatabaseBlobAuditingPolicy(extendedDatabasePolicy, extendedDatabaseResultPolicy); await client.Databases.DeleteAsync(resourceGroup.Name, server.Name, database.Name); await client.Servers.DeleteAsync(resourceGroup.Name, server.Name); await DeleteStorageAccountAsync(context, resourceGroup.Name, storageAccountInformation.Name); } }
public PSStorageAccountInfo(StorageAccountInformation baseAccount) : base( id: baseAccount.Id, name: baseAccount.Name, type: baseAccount.Type, suffix: baseAccount.Suffix) { }
/// <summary> /// Initializes a new instance of the <see cref="AdlDataSource"/> class. /// </summary> /// <param name="dataSourceInfo">The data source information.</param> public AdlDataSource(StorageAccountInformation dataSourceInfo) { Name = dataSourceInfo.Name; Type = DataLakeAnalyticsEnums.DataSourceType.Blob; // always false because there is no concept of a default blob storage container for ADL. IsDefault = false; }
public async void TestServerBlobAuditingPolicy() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { ResourceGroup resourceGroup = context.CreateResourceGroup(); SqlManagementClient client = context.GetClient <SqlManagementClient>(); Server server = context.CreateServer(resourceGroup); StorageAccountInformation storageAccountInformation = await CreateStorageAccountAsync(context, resourceGroup); ServerBlobAuditingPolicy serverPolicy = new ServerBlobAuditingPolicy { State = BlobAuditingPolicyState.Enabled, StorageEndpoint = storageAccountInformation.Endpoint, StorageAccountAccessKey = storageAccountInformation.PrimaryKey, RetentionDays = RetentionDays, IsStorageSecondaryKeyInUse = IsStorageSecondaryKeyInUse, IsAzureMonitorTargetEnabled = true, QueueDelayMs = 1000 }; ExtendedServerBlobAuditingPolicy extendedServerPolicy = new ExtendedServerBlobAuditingPolicy { State = BlobAuditingPolicyState.Enabled, StorageEndpoint = storageAccountInformation.Endpoint, StorageAccountAccessKey = storageAccountInformation.PrimaryKey, RetentionDays = RetentionDays, IsStorageSecondaryKeyInUse = IsStorageSecondaryKeyInUse, PredicateExpression = PredicateExpression, IsAzureMonitorTargetEnabled = true, QueueDelayMs = 1000 }; ServerBlobAuditingPolicy serverResultPolicy = await client.ServerBlobAuditingPolicies.CreateOrUpdateAsync(resourceGroup.Name, server.Name, serverPolicy); VerifyServerBlobAuditingPolicy(serverPolicy, serverResultPolicy); serverResultPolicy = await client.ServerBlobAuditingPolicies.GetAsync(resourceGroup.Name, server.Name); VerifyServerBlobAuditingPolicy(serverPolicy, serverResultPolicy); ExtendedServerBlobAuditingPolicy extendedServerResultPolicy = await client.ExtendedServerBlobAuditingPolicies.CreateOrUpdateAsync(resourceGroup.Name, server.Name, extendedServerPolicy); VerifyExtendedServerBlobAuditingPolicy(extendedServerPolicy, extendedServerResultPolicy); extendedServerResultPolicy = await client.ExtendedServerBlobAuditingPolicies.GetAsync(resourceGroup.Name, server.Name); VerifyExtendedServerBlobAuditingPolicy(extendedServerPolicy, extendedServerResultPolicy); await client.Servers.DeleteAsync(resourceGroup.Name, server.Name); await DeleteStorageAccountAsync(context, resourceGroup.Name, storageAccountInformation.Name); } }
public async void TestServerDevOpsAuditingSettings() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { SqlManagementClient client = context.GetClient <SqlManagementClient>(); ResourceGroup resourceGroup = context.CreateResourceGroup(); Server server = context.CreateServer(resourceGroup); StorageAccountInformation storageAccountInformation = await CreateStorageAccountAsync(context, resourceGroup); ServerDevOpsAuditingSettings devOpsSettings = new ServerDevOpsAuditingSettings { State = BlobAuditingPolicyState.Enabled, StorageEndpoint = storageAccountInformation.Endpoint, StorageAccountAccessKey = storageAccountInformation.PrimaryKey, IsAzureMonitorTargetEnabled = true }; ServerDevOpsAuditingSettings resultDevOpsSettings = await client.ServerDevOpsAuditSettings.CreateOrUpdateAsync(resourceGroup.Name, server.Name, PolicyName, devOpsSettings); VerifyPolicy(devOpsSettings, resultDevOpsSettings); resultDevOpsSettings = await client.ServerDevOpsAuditSettings.GetAsync(resourceGroup.Name, server.Name, PolicyName); VerifyPolicy(devOpsSettings, resultDevOpsSettings); IPage <ServerDevOpsAuditingSettings> resultItems = await client.ServerDevOpsAuditSettings.ListByServerAsync(resourceGroup.Name, server.Name); foreach (ServerDevOpsAuditingSettings resultItem in resultItems) { VerifyPolicy(devOpsSettings, resultItem); } Assert.Null(resultItems.NextPageLink); await client.Servers.DeleteAsync(resourceGroup.Name, server.Name); await DeleteStorageAccountAsync(context, resourceGroup.Name, storageAccountInformation.Name); } }