Share via


How to: Provision a FIM Certificate Management Linked Temporary Card Request

The following examples show how to provision a Forefront Identity Manager Certificate Management (FIM CM) Temporary Card request for a temporary card that is linked to an existing profile. The first example demonstrates how to do this using CreateLinkedTempCardRequest. The second example shows a more manual approach.

CLMUtils.CreateLinkedTempCardRequest

Sub Provision(ByVal mventry As MVEntry)
    Implements IMVSynchronization.Provision

    Try
        If mventry("objectGUID").IsPresent Then
            CLMUtils.CreateLinkedTempCardRequest(CLMMA,
                New Guid(mventry("objectGUID").BinaryValue),
                "CLM Sample Profile Template")
        End If
    ' Log and rethrow any exception.
    Catch ex As Exception
        Logging.Logging.LogException(ex,
            "Provision",
            "Caught exception",
            False)
        Throw
    End Try

End Sub 'IMVSynchronization.Provision
void IMVSynchronization.Provision (MVEntry mventry)
{
    try
    {
        if (mventry["objectGUID"].IsPresent)
        {
            CLMUtils.CreateLinkedTempCardRequest(CLMMA,
                new Guid(mventry["objectGUID"].BinaryValue),
                "CLM Sample Profile Template");
        }
    }
    // Log and rethrow any exception.
    catch(Exception ex)
    {
        Logging.Logging.LogException(ex,
            "Provision",
            "Caught exception",
            false);
        throw;
    }
}

Provision Linked Temporary Card Request

Sub Provision(ByVal mventry As MVEntry)
    Implements IMVSynchronization.Provision

    Try
        If mventry("objectGUID").IsPresent Then
            Dim targetCLMMA As ConnectedMA =
                mventry.ConnectedMAs("CertificateLifecycleManagerMA")
            
            Dim csentry As CSEntry =
                targetCLMMA.Connectors.StartNewConnector("clmRequest")
            
            csentry.DN = targetCLMMA.EscapeDNComponent("CN=" +
                Guid.NewGuid().ToString())
            
            csentry("req_type").IntegerValue =
                Fix(RequestTypeEnum.TemporaryCardEnroll)
            csentry("req_type_name").Value =
                [Enum].GetName(GetType(RequestTypeEnum),
                RequestTypeEnum.TemporaryCardEnroll)
            csentry("req_target_user_uuid").BinaryValue =
                aDObjectGUID.ToByteArray()
            csentry("req_profile_template_name").Value =
                profileTemplateName
' UUID of the profile csentry object to which you want to link this
' request.
            csentry("req_profile_uuid").BinaryValue =
                profileCSEntry("profile_uuid").BinaryValue
' UUID of the permanent smart card, which you can get from the
' profile csentry object to which you want to link this request.
            csentry("req_permanent_sc_uuid").BinaryValue =
                profileCSEntry("pr_sc_uuid").BinaryValue
            csentry("req_originator_user_uuid").BinaryValue =
                originatorGuid.ToByteArray()
            csentry("req_profile_template_uuid").BinaryValue =
                GetProfileTemplateUuidFromProfileTemplateName(
                    profileTemplateName,
                    targetCLMMA).ToByteArray()
            csentry.CommitNewConnector()
        End If
    
    ' Log and rethrow any exception.
    Catch ex As Exception
        Logging.Logging.LogException(ex, "Provision", "Caught exception", False)
        Throw
    End Try

End Sub 'IMVSynchronization.Provision
void IMVSynchronization.Provision(MVEntry mventry)
{
    try
    {
        if (mventry["objectGUID"].IsPresent)
        {
            ConnectedMA targetCLMMA =
                mventry.ConnectedMAs["CertificateLifecycleManagerMA"];

            CSEntry csentry =
                targetCLMMA.Connectors.StartNewConnector("clmRequest");

            csentry.DN = targetCLMMA.EscapeDNComponent("CN=" +
                Guid.NewGuid().ToString());

            csentry["req_type"].IntegerValue =
                (long)RequestTypeEnum.TemporaryCardEnroll;
            csentry["req_type_name"].Value =
                Enum.GetName(typeof(RequestTypeEnum),
                RequestTypeEnum.TemporaryCardEnroll);
            csentry["req_target_user_uuid"].BinaryValue =
                aDObjectGUID.ToByteArray();
            csentry["req_profile_template_name"].Value =
                profileTemplateName;
// UUID of the profile csentry object to which you want to link this
// request.
            csentry["req_profile_uuid"].BinaryValue =
                profileCSEntry["profile_uuid"].BinaryValue;
// UUID of the permanent smart card, which you can get from the
// profile csentry object to which you want to link this request.
            csentry["req_permanent_sc_uuid"].BinaryValue =
                profileCSEntry["pr_sc_uuid"].BinaryValue;
            csentry["req_originator_user_uuid"].BinaryValue =
                originatorGuid.ToByteArray();
            csentry["req_profile_template_uuid"].BinaryValue =
                GetProfileTemplateUuidFromProfileTemplateName(
                    profileTemplateName,
                    targetCLMMA).ToByteArray();
            csentry.CommitNewConnector();
        }
    }

    // Log and rethrow any exception.
    catch (Exception ex)
    {
        Logging.Logging.LogException(ex,
            "Provision",
            "Caught exception",
            false);
        throw;
    }
}

See Also

Reference

CreateLinkedTempCardRequest

Concepts

Forefront Identity Manager Certificate Management Connected Data Sources