As per the page, options are given to use --data-collection-rule-id & --data-collection-endpoint-id but its no where mentioned that both options can't be use together.
#az monitor data-collection rule association create --name "NAME_OF_DCR_RULE" --rule-id "DCR_RULE_ID" --resource "VM_RESOURCE_ID" with this command, you cannot use --data-collection-endpoint-id "endpoint_resource_id" . Error will be "Association name for resource to endpoint must be configurationAccessEndpoint"
Now, to resolve this error, you need to associate DCR and DCE separately. You cannot use it together.
So, to Associate VM with DCR,
#az monitor data-collection rule association create --name "NAME_OF_DCR_RULE" --rule-id "DCR_RULE_ID" --resource "VM_RESOURCE_ID"
Now, time to associate endpoint with the VM,
#az monitor data-collection rule association create --name "configurationAccessEndpoint" --resource "VM_RESOURCE_ID" --endpoint-id "endpoint_ID"
As per the page, options are given to use --data-collection-rule-id & --data-collection-endpoint-id but its no where mentioned that both options can't be use together.
#az monitor data-collection rule association create --name "NAME_OF_DCR_RULE" --rule-id "DCR_RULE_ID" --resource "VM_RESOURCE_ID" with this command, you cannot use --data-collection-endpoint-id "endpoint_resource_id" . Error will be "Association name for resource to endpoint must be configurationAccessEndpoint"
Now, to resolve this error, you need to associate DCR and DCE separately. You cannot use it together.
So, to Associate VM with DCR,
#az monitor data-collection rule association create --name "NAME_OF_DCR_RULE" --rule-id "DCR_RULE_ID" --resource "VM_RESOURCE_ID"
Now, time to associate endpoint with the VM,
#az monitor data-collection rule association create --name "configurationAccessEndpoint" --resource "VM_RESOURCE_ID" --endpoint-id "endpoint_ID"