iosmdmairwatch

iOS: How to set the device serial number via application configuration in airwatch?


In JAMF, you can use "App Configuration" to tell the device it's own serial number using something like this:

<dict>
    <key>device_serial_number</key>
    <string>$SERIALNUMBER</string>
</dict>

You just paste that directly into the "App Configuration" box in the "Mobile App" area of the dashboard:

enter image description here

This will tell the device it's own serial number, as that information is not available otherwise.

I'm wondering if you can do the same thing in AirWatch. For their configuration, it's a list of key value fields. I've tried a bunch of different items in the "value" field, such as:

{SerialNumber}, {serialNumber}, {Serial}, $SERIALNUMBER, {serialnumber}, {serial}, but it does not seem to work.

Anyone know how to inform an iOS device of it's serial number using AirWatch?


Solution

  • The AppConfig variable for serial number on AirWatch is {DeviceSerialNumber}. Here's the full list:

    {EmailDomain}
    {EmailUserName}
    {EmailAddress}
    {EnrollmentUser}
    {EnrollmentUserId}
    {DeviceUid}
    {DynamicScepChallenge}
    {GroupIdentifier}
    {SessionToken}
    {DeviceFriendlyName}
    {DeviceSerialNumber}
    {UserPrincipalName}
    {DeviceSerialNumberLastFour}
    {DevicePlatform}
    {DeviceModel}
    {DeviceOperatingSystem}
    {EmailUserNamePrompt}
    {DeviceUidLastFour}
    {DeviceReportedName}
    {EmailPassword}
    {DeviceAssetNumber}
    {DeviceWLANMac}
    {UserSmimeSigning}
    {UserSmimeEncryption}
    {SecureDeviceUdid}
    {UserDistinguishedName}
    {FirstName}
    {LastName}
    {EmailAddressPrompt}
    {EmailDomainPrompt}
    

    You can put this into the "Assignment" for an app here:

    Assignment

    Once it's there you can access it via UserDefaults like this:

    /**
     Retrieve the dictionary of keys stored by the MDM server
    
     - returns: dictionary of key/value pairs
     */
    public func appConfig ()  -> Dictionary<String, Any>? {
        if let serverConfig = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed")
        {
            return serverConfig
        }
        return nil
    }