# MonitorDataCollectionRule: unexpected status 400 (400 Bad Request) with error

**URL:** <https://discuss.hashicorp.com/t/monitordatacollectionrule-unexpected-status-400-400-bad-request-with-error/75128>\
**Category:** CDK for Terraform\
**Created:** [May 22, 2025, 4:58pm UTC](https://discuss.hashicorp.com/t/monitordatacollectionrule-unexpected-status-400-400-bad-request-with-error/75128 "2025-05-22T16:58:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kurt-mueller-osumc](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/kurt-mueller-osumc/32/45735_2.png) [@kurt-mueller-osumc](https://discuss.hashicorp.com/u/kurt-mueller-osumc)\
**Post date:** [May 22, 2025, 4:58pm UTC](https://discuss.hashicorp.com/t/monitordatacollectionrule-unexpected-status-400-400-bad-request-with-error/75128/1 "2025-05-22T16:58:02Z")

</div>

When I run `cdktf deploy` to provision a data collection rule, I get the following error:

```bash
 Error: creating Data Collection Rule (Subscription: "a475b49b-c65e-46a7-9c63-1ec577986549"
                    │ Resource Group Name: "rg-mprt"
                    │ Data Collection Rule Name: "dcr-mprt-sandbox"): unexpected status 400 (400 Bad Request) with error: InvalidPayload: Data collection rule is invalid
                    │ 
                    │ with azurerm_monitor_data_collection_rule.stack-monitor-mprt-sandbox_data-collection-rule-mprt_B0ED6D0E (stack-monitor-mprt-sandbox/data-collection-rule-mprt),
                    │ on cdk.tf.json line 662, in resource.azurerm_monitor_data_collection_rule.stack-monitor-mprt-sandbox_data-collection-rule-mprt_B0ED6D0E (stack-monitor-mprt-sandbox/data-collection-rule-mprt):
                    │ 662: }
                    │ 
                    │ creating Data Collection Rule (Subscription:
                    │ "a475b49b-c65e-46a7-9c63-1ec577986549"
                    │ Resource Group Name: "rg-mprt"
                    │ Data Collection Rule Name: "dcr-mprt-sandbox"): unexpected status 400 (40

```

I’ve tried turning on debugging and logging in order to help pinpoint the error with the following command:

```bash
CDKTF_LOG_LEVEL=debug TF_LOG_LEVEL=debug CDKTF_LOG_FILE_DIRECTORY="." cdktf deploy stack-mprt-sandbox

```

However, setting the log level doesn’t seem to actually increase the output information in the log.

How can I go about effectively debugging the underlying error when provisioning this resource? Thanks for any and all info.
