IsEnabled
has nothing to do with whether the telemetry would actually work or not. The only way to know that is to actually try. There could be any # of things wrong such that the actual call fails, such as a missing or invalid key.
All it looks at is whether it is enabled such that the code should even attempt to make the call. By default it is enabled and therefore always true. However telemetry can be disabled in the configuration which prevents it altogether.
If you're interested, all this property really does is return TelemetryConfiguration.DisableTelemetry
on the configuration associated with the client. The configuration is passed to the client instance when it is created.
Now you may be wondering why the startup code is allowing you to register the services (which is ultimately what you're getting) without having the configuration right. That is likely because you can configure the telemetry multiple ways and ultimately the client will attempt to use it, which triggers the actual initialization. But simply getting the client and checking the IsEnabled
property doesn't trigger any of this initialization, it is a simple property lookup.