def METHOD_NAME(self, resource_group_name, resource_name):
    # Setup User Assigned Identity
    identity_name = self.get_resource_name("identityResource")
    if self.is_live:
        msi = self.msi_client.user_assigned_identities.create_or_update(resource_group_name, identity_name, {"location": AZURE_LOCATION})
        msi_id = msi.id    
    else:
        msi_id = f"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity_name}"
    # Create digital twin with UserAssigned
    BODY = {
        "location": AZURE_LOCATION,
        "identity": {
            "type": "UserAssigned",
            "userAssignedIdentities": {
                msi_id: {}
            }
        }
    }
    result = self.client.digital_twins.begin_create_or_update(resource_group_name = resource_group_name, resource_name = resource_name, digital_twins_create = BODY)
    result = result.result()
    assert result.name == resource_name
    assert result.identity is not None
    return msi_i