Renew secret token of Azure web-app

One of our customers had an App installed more than a year ago on their O365 site. For this App the secret token was expired and I had to renew this. Because the solution in this article was not straight forward in my case, I thought about writing this blogpost.


Open the SharePoint Online Management Shell, type Connect-msolservice and login to the tenant
When using the script at this site does not work. The last line with output to a txt file does not work
I created to scripts. Script 1 starts script 2 and writes output to a text file

Script 1

.\script2.ps1 > output.txt

Script 2

Next step in the Technet article is to get the client ID of the App. Therefore I have to connect to the Azure management portal to get FTP settings. By using FTP you can get the web.config file of the App.


Connect to
Go to App Services

Azure App Services
Select the App
Under “Essentials” there has to be an FTP username. In the portal of this customer there ain’t a username.

No FTP account

FTP account

On this blog I found a solution to get the FTP account. Azure provides you with a Publish Profile that you can download.


A file is downloaded named <appname>.publishsettings.
Open this file with ie Notepad++
From this file you need the values Publish URL, User name and password. Also the FTP hostname.


Now set up a connection to the FTP host. I use a program like Filezilla
I created a New Site in Filezilla with the FTP host name, user name and password


After connecting I got a certificate warning


I checked the “Always trust certificate in future sessions” checkbox and continued.
After connection Filezilla shows the content of the directory. Now we can download the web.config file that we need for the client ID
Open the web.config with i.e. Notepad++ and search for the client ID


Create new secret

In the SharePoint online management shell (with you have still open off course) create a client ID variable

Generate a new client secret with

Change the web.config like in the article is mentioned with the old key on a separate line.
Upload the web.config to Azure.

Now you are done and the App can be used for another year.

Leave a Reply

Your email address will not be published. Required fields are marked *