New-AzDataCollectionRuleAssociation – Operation returned an invalid status code ‘BadRequest’

Was trying to associate some data collection rules in Azure and the cmdlet kept throwing up this unhelpful error:

After a bit of trial and error I figured out the issue. The association name shouldn’t contain spaces etc. I was doing -AssociationName "blah blah" while it should have been -AssociationName "blah-blah".

Could have just told me that! šŸ™‚