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.

PowerShell

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.

Azure

Connect to https://portal.azure.com
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 http://blogs.msdn.com/b/msgulfcommunity/archive/2014/10/23/how-to-get-ftp-credentials-for-windows-azure-websites.aspx I found a solution to get the FTP account. Azure provides you with a Publish Profile that you can download.

03publishprofile

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.

FTP

Now set up a connection to the FTP host. I use a program like Filezilla https://filezilla-project.org/
I created a New Site in Filezilla with the FTP host name, user name and password

05Filezilla

After connecting I got a certificate warning

06certificatewarning

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

appsettings

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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">