public function getAppObjectId()
{
$path = '/' . $this->tenantName . '/servicePrincipals';
$headers = ['Authorization' => 'Bearer ' . $this->getClientToken()->token];
$query = ['$filter' => "appId eq '{$this->appClientId}'"];
$request = $this->getClient()->prepareRequest($path, 'GET', self::GRAPH_API_VERSION, self::URL_GRAPH_WINDOWS, $query, [], $headers);
$response = $this->getClient()->call($request);
$responseObj = json_decode($response->getContent());
if (empty($responseObj)) {
throw new AzureException('Bad server response format for app-object-id-request.', 1);
}
if (!$response->hasError()) {
foreach ($responseObj->value as $value) {
if (isset($value->appId) && $value->appId == $this->appClientId) {
$this->appObjectId = $value->objectId;
break;
}
}
}
return $this->appObjectId;
}