Skip to content

IoT Team task #286 Remove the hard coded URLs from the EventGrid function and make it work stable

Laila edited this page Mar 23, 2020 · 1 revision

Removing hard coded URLS in Event Grid Python code:

  • First, I opened my function(iotapp-function) in Azure portal
  • Under Configuration, click on + New application setting
  • There, I chose a name (ex: GetEndpoint) and passed in the GET URL from GET function on Azure
  • I did the same thing for PUT and POST functions
  • Then in Python code, I imported os
  • And used getURL = os.environ["GetEndpoint"]
  • putURL = os.environ["PutEndpoint"]
  • postURL = os.environ["PostEndpoint"]
  • With above steps, URLS are hidden in Configuration of my function in the Cloud and does not show in my code
  • This is useful for security purposes and also in case of having to change the URL in the future
Clone this wiki locally