💀 The code in this lab is NOT meant to be used for production environments. It is a simple example with no error handling, no custom workflows, and is for learning purposes only.
In this lab, you will build on what you accomplished in previous labs. You will create a SaaS offer webhook and eventually integrate it with your Partner Center SaaS offer configuration, enabling your webhook to respond to subscription change events.
The webhook in your Visual Studio solution is an Azure Function. There is no need to change the code in the webhook function at this time.
Looking through the webhook code you'll find that it simply prints the REST payload to the log. You will monitor this log to see the payload when the webhook is called.
-
In Visual Studio, right click the
SaaSFunctions
project and select Publish. -
For the target, select Azure and click Next.
-
Select Azure Function App (Windows) and click Next.
-
Select the right subscription in the dropdown.
-
To publish, you will need to create a new Function App. Above and to the right of the Function Apps tree at the bottom of the dialog, click the + button to add a new Function App.
-
In the Name field, enter
SaaSWorkshopFunction
followed by a number to make it a unique name. -
Select the right subscription.
-
Select the `saas-workshop`` Resource Group.
-
Stick with Plan Type: Consumption.
-
Function Apps require the use of a Data Storage account. To the right of the Azure Storage field is a New... link. Click it.
-
On the Azure storage dialog, click the OK button.
-
Back on the Function App (windows) dialog, click the Create button.
The App Service deployment will run for a little while.
-
On the Publish dialog, click the Next button.
-
On Select the Publish option and click the Finish button.
You have create an App Service, App Service Plan, storage account, and a publish profile. Now you will use the purlish profile to publish the function application itself.
At the top right of the publish screen, click the Publish button.
It will take a moment to publish the function application. You can watch progress in Visual Studio's Output window.
You need the webhook URI to add to your Technical Configuration in Partner Center. The Function Application contains only one function and you need the URI of that one function.
- Open the Azure portal.
- Find and click on the Azure function in the Azure portal. It is inside your
saas-workshop
resource group. - In the left-hand menu find the Functions link and click it.
- You see a single function named
Webhook
. Click that function. - Near the top of the screen, click Get Function URL and you are presented with a dialog.
- Copy the full path to this function into your copy/paste buffer.
Now you will populate your offer, with a valid webhook URL.
- In Partner Center, on the Technical configuration tab, find the Connection webhook field.
- Replace the previous value for the Connection webhook with the URL of the function application
- Click Save Draft.
Congratulation! You have finished this lab.