iOS 18.2で導入されたアカウント駆動エンロールメントの新しいフロー

Apple Configuratorでの自動登録を完了できるように、新しいスキップキーが追加されました。
アカウント駆動型の登録の一環としてのサービス検出で、Apple School ManagerまたはApple Business ManagerにリンクされたMDMソリューションによって指定された代替場所から、周知のリソースをリクエストできるようになりました。
iwaki@something.com
のようなメアドを入れたときに、 https://something.com/.well-known/com.apple.remotemanagement という場所に特定のコンテンツを置いてないといけなかったのが、Apple Business Managerを介してやれるようになった、と。
会社のIT部門が必ずしもドメインの管理やその先のホームページの管理をしていない場合、会社のホームページが .well-known など任意のコンテンツを置けるようなCMSを採用していない場合などに対応したと思われる。

For devices with iOS 18.2, iPadOS 18.2, macOS 15.2, visionOS 2.2, or later, the service discovery process allows a device to fetch the well-known resource from an alternative location specified by the MDM solution linked to Apple School Manager or Apple Business Manager. The first preference for service discovery is still the well-known resource at the organization’s domain. In the event that the request fails, the device proceeds to check with Apple School Manager or Apple Business Manager for an alternate location of the well-known resource. This process requires the domain used in the identifier to be verified in Apple School Manager or Apple Business Manager. For more information, see Add and verify a domain in Apple School Manager or Add and verify a domain in Apple Business Manager.
なんかFallbackでApple Business Managerを見に行くルートが増えてる。
mdmenrollmentのほうのAPIも増えてる。

ドメインはリンクされて確認済みにもなっていた。なので、適当に、会社のメールアドレスを入れてみる。
...うまくいかなかったのでログを見てみたところ、
Invalid well-known response for https://i3-systems.com/.well-known/com.apple.remotemanagement?user-identifier=iwaki@i3-systems.com&model-family=iPad: <NSHTTPURLResponse: 0x300a9f420>
Invalid well-known response for https://axm-servicediscovery.apple.com/mdmBaseURL?user-identifier=iwaki@i3-systems.com&model-family=iPad: <NSHTTPURLResponse: 0x3009047a0>
メアドのドメインである https://ドメイン/.well-known/com.apple.remotemanagement
にアクセスして、だめだったら https://axm-servicediscovery.apple.com/mdmBaseURL
に同じクエリパラメータでアクセスしてそう。
If the assigned MDM solution has configured a service discovery URL, the device proceeds to request the well-known resource from that location. To set the default device assignment, see Set the default device assignment in Apple School Manager or Set the default device assignment in Apple Business Manager.
とあるので、
ここの設定も必要なんだろうか?

[3] pry(main)> DepClient.new(DepServerToken.last).post('account-driven-enrollment/profile', {mdm_service_discovery_url: 'https://bright-reptile-slightly.ngrok-free.app/mdm/service_discovery'})
D, [2024-12-24T18:03:13.355090 #8] DEBUG -- : DepServerToken Load (1.1ms) SELECT "dep_server_tokens".* FROM "dep_server_tokens" ORDER BY "dep_server_tokens"."id" DESC LIMIT $1 [["LIMIT", 1]]
D, [2024-12-24T18:03:13.355936 #8] DEBUG -- : ↳ (pry):3:in `__pry__'
I, [2024-12-24T18:03:13.358614 #8] INFO -- request: GET https://mdmenrollment.apple.com/session
I, [2024-12-24T18:03:13.358686 #8] INFO -- request: User-Agent: "Faraday v1.10.3"
...
I, [2024-12-24T18:03:14.200386 #8] INFO -- response: "200 OK"
=> "200 OK"
http "https://axm-servicediscovery.apple.com/mdmBaseURL?user-identifier=iwaki@i3-systems.com&model-family=iPad"
HTTP/1.1 404 Not Found
もう一度sysdiagnose見てみる。
Service URL from wellknown URL request finished with data: 95 bytes, response: <NSHTTPURLResponse: 0x300af6a60> { URL: https://axm-adm-enroll.apple.com/.well-known/com.apple.remotemanagement?user-identifier=iwaki@i3-systems.com&model-family=iPad } { Status Code: 200, Headers {
なんかさらに違うURLを見に行っていて、そちらは200 OKを返しているようだ。
{
"Servers": [
{
"BaseURL": "https://axm-adm-enroll.apple.com/enroll/adde",
"Version": "apple-adde"
}
]
}
なんか全然別のAppleのサーバーにエンロールしに行こうとしている?!
これはたぶん関係なさそうだ。

わからないのでForumに投げておいた。

mdmenrollmentのほうのAPIも増えてる。
が404になっていて、代わりに以下のページが増えた。POSTだけじゃなくてGETとDELETEもできるようになっているっぽい。
[3] pry(main)> DepClient.new(DepServerToken.last).get('account-driven-enrollment/profile')
=> {"mdm_service_discovery_url"=>"https://bright-reptile-slightly.ngrok-free.app/mdm/service_discovery", "last_updated_timestamp"=>"2024-12-24T18:42:02Z"}
たしかにできるようになっている。
あと、認証済みドメインのほうではなく、Apple Business Managerのデフォルトドメインの方だといけた...?!
axm-servicediscovery.apple.com/mdmBaseURLが、知っているドメインであれば307リダイレクトするらしい。
http "https://axm-servicediscovery.apple.com/mdmBaseURL?user-identifier=iwaki@っxxxxxxxxx.appleid.com&model-family=iPad"
HTTP/1.1 307 Temporary Redirect
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 154
Date: Wed, 26 Feb 2025 16:11:47 GMT
Location: https://starfish-gentle-glowworm.ngrok-free.app/mdm/service_discovery?model-family=iPad&user-identifier=iwaki%40xxxxxxxxx.appleid.com
Server: Apple
Strict-Transport-Security: max-age=31536000; includeSubdomains
Vary: content-encoding
X-Apple-Request-Uuid: 900308a0-14ce-439e-8ce9-89b23e967b85
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
{"baseUrl":"https://starfish-gentle-glowworm.ngrok-free.app/mdm/service_discovery?model-family=iPad&user-identifier=iwaki%40xxxxxxxxx.appleid.com"}