コード例 #1
0
        internal virtual void PolicizePublicStorageInfo(AuditModelType model, ProxyResource policy)
        {
            dynamic dynamicPolicy = (dynamic)policy;

            dynamicPolicy.StorageAccountAccessKey = AzureCommunicator.RetrieveStorageKeysAsync(
                model.StorageAccountResourceId).GetAwaiter().GetResult()[GetStorageKeyKind(model) == StorageKeyKind.Secondary ? StorageKeyKind.Secondary : StorageKeyKind.Primary];
        }
コード例 #2
0
        protected override void PolicizeAuditModel(SqlPoolAuditModel model, ProxyResource policy)
        {
            dynamic dynamicPolicy = (dynamic)policy;

            base.PolicizeAuditModel(model, policy);

            dynamicPolicy.AuditActionsAndGroups = ExtractAuditActionsAndGroups(model.AuditActionGroup, model.AuditAction);
        }
コード例 #3
0
        internal override void PolicizePublicStorageInfo(AuditModelType model, ProxyResource policy)
        {
            dynamic dynamicPolicy = (dynamic)policy;

            base.PolicizePublicStorageInfo(model, policy);

            dynamicPolicy.IsStorageSecondaryKeyInUse = model.StorageKeyType == StorageKeyKind.Secondary;
        }
コード例 #4
0
        internal override void PolicizeStorageInfo(AuditModelType model, ProxyResource policy)
        {
            dynamic dynamicPolicy = (dynamic)policy;

            base.PolicizeStorageInfo(model, policy);

            if (model.RetentionInDays != null)
            {
                dynamicPolicy.RetentionDays = (int)model.RetentionInDays;
            }
        }
コード例 #5
0
        protected virtual void PolicizeAuditModel(AuditModelType model, ProxyResource policy)
        {
            dynamic dynamicPolicy = (dynamic)policy;

            dynamicPolicy.State = model.BlobStorageTargetState == AuditStateType.Enabled ||
                                  model.EventHubTargetState == AuditStateType.Enabled ||
                                  model.LogAnalyticsTargetState == AuditStateType.Enabled ?
                                  BlobAuditingPolicyState.Enabled : BlobAuditingPolicyState.Disabled;

            dynamicPolicy.IsAzureMonitorTargetEnabled = model.IsAzureMonitorTargetEnabled;

            if (model.BlobStorageTargetState == AuditStateType.Enabled)
            {
                PolicizeStorageInfo(model, policy);
            }
        }
コード例 #6
0
        internal virtual void PolicizeStorageInfo(AuditModelType model, ProxyResource policy)
        {
            dynamic dynamicPolicy = (dynamic)policy;

            ExtractStorageAccountProperties(model.StorageAccountResourceId, out string storageAccountName, out Guid storageAccountSubscriptionId);

            dynamicPolicy.StorageEndpoint = GetStorageAccountEndpoint(storageAccountName);
            dynamicPolicy.StorageAccountSubscriptionId = storageAccountSubscriptionId;

            if (AzureCommunicator.IsStorageAccountInVNet(model.StorageAccountResourceId))
            {
                Guid?principalId = Communicator.AssignWorkspaceIdentityIfNotAssigned(model.ResourceGroupName, model.WorkspaceName);
                AzureCommunicator.AssignRoleForWorkspaceIdentityOnStorageIfNotAssigned(model.StorageAccountResourceId, principalId.Value, RoleAssignmentId);
            }
            else
            {
                PolicizePublicStorageInfo(model, policy);
            }
        }