How to add a Material Instance Dynamic to a Procedural Mesh Component?

I cannot figure out how to add a UMaterialInstanceDynamic to a UProceduralMeshComponent.

The function UProceduralMeshComponent::SetMaterial() expects a UMaterialInterface for its input, but I tried casting my MID like this:

ProceduralMesh->SetMaterial(0, Cast<UMaterialInterface>(DynamicMaterial));

But it doesn’t work, the Procedural Mesh ends up without a material. And yet, in Blueprint, you can very easily add a Material Instance Dynamic to a Procedural Mesh.

What am I doing wrong?