• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Azure DNS access token

SimonB

New Pleskian
We are using the Azure DNS extension with Plesk Obsidian (Version 18.0.40 Update #3) on a Windows 2019 Server.

It was all working fine a few months ago, but we just got a message from Let's encrypt saying the SSL cert is about to run out on one of the domains. After a bit of fault finding I tried to go into the Azure DNS extension, but we can not longer go into the extensions page.

When we try it re-directs us to the plesk home page with 3 messages at the top of the screen.

  • Error: Could not get access token: invalid_client
  • Error: Could not get access token: invalid_client
  • Information: The extension is already authorized.

1644229540400.png

The php_error.log for that time period has the following errors

Code:
file: C:\Program Files (x86)\Plesk\admin\plib\modules\azuredns\library\Client\AzureDnsClient.php
line: 371
code: 0
trace: #0 C:\Program Files (x86)\Plesk\admin\plib\modules\azuredns\library\Client\AzureDnsClient.php(168): PleskExt\AzureDns\Client\AzureDnsClient->getAccessToken()
#1 C:\Program Files (x86)\Plesk\admin\plib\modules\azuredns\controllers\AuthController.php(53): PleskExt\AzureDns\Client\AzureDnsClient->listByResourceGroup()
#2 C:\Program Files (x86)\Plesk\admin\plib\vendor\plesk\zf1\library\Zend\Controller\Action.php(516): AuthController->indexAction()
#3 C:\Program Files (x86)\Plesk\admin\plib\vendor\plesk\zf1\library\Zend\Controller\Dispatcher\Standard.php(308): Zend_Controller_Action->dispatch(string 'indexAction')
#4 C:\Program Files (x86)\Plesk\admin\plib\vendor\plesk\zf1\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(object of type Zend_Controller_Request_Http, object of type Zend_Controller_Response_Http)
#5 C:\Program Files (x86)\Plesk\admin\plib\pm\Application.php(91): Zend_Controller_Front->dispatch()
#6 C:\Program Files (x86)\Plesk\admin\htdocs\modules\azuredns\index.php(5): pm_Application->run()

[2022-02-07 10:10:30] 18876:6200f016a99b2 ERR [panel.ui] Could not get access token: invalid_client
[2022-02-07 10:10:31] 18876:6200f0174ea54 ERR [panel.ui] Could not get access token: invalid_client

Is there a wat to check / update the access tokens without going into the Azure DNS extension? or is there another way to fix this issue?

I thought about uninstalling the extension then re-installing it but I dont know if that will wipe out the DNS setting or not?
 
Update: Just updated to Plesk ObsidianVersion 18.0.41 Update #1, and the same problem, unable to get into the Azure DNS extension page.
 
Most probably, that application secret key stored in the Plesk database is different from the one configured on the Azure side. Check it in the Plesk database with the following SQL query:
Code:
plesk db"select * from ModuleSettings where module_id=28"
+-----------+----------------+--------------------------------------+
| module_id | name | value |
+-----------+----------------+--------------------------------------+
...
| 28 | secret | 2hI3y1-fM.h8cWVqSaK45u~y53ztCS_9Am |
...
You can update this secret key with:
Code:
# plesk db "UPDATE ModuleSettings SET value = '<your secret key>' where module_id=28 and name='secret'"
 
Thanks for your help it's much appreciated, after updating the secret I can now get into the Azure DNS extension and the new DNS values are been pushed to Azure.

For anyone else reading this who is having the same problem, to get the correct module_id, run the below SQL first and look for the azuredns record (it was 20 on our plesk)

Code:
select * from Modules

This happened because the client secret in Azure Active Directory expires after a period of time (the default is 6 months), so needs to be updated.

The Plesk docuemntation show a "never" expire option

See : Step 5 - Creating a secret - Part 2

But it looks like Micorsoft has removed the "never" expire option

1644402491447.png
 
Back
Top