Using a single Azure Function to access multiple users' resources on their behalf









up vote
0
down vote

favorite












TL;DR: I'm not sure how to go about accessing multiple users' in our organization's calendar resources (read only), and if it's possible to do so in a single Azure Function. Any guidance to what I can do would be much appreciated.



As the title says, I'm looking for a way to access multiple user's resources on their behalf using Azure Functions and the Microsoft Graph API. Currently I have a little bit of experience using the Auth Token binding, but so far I've only been able to use a single user-id as an input to fetch the token they'd consented access to. I'd like to be able to access multiple users' tokens in a single function, regardless of if I need to use the Auth Token binding or coding in some other method of obtaining and retrieving said tokens. Currently the only way that I can see making this work with the Auth Token binding would be to create an Azure Function for each of our users individually, which would require an administrator to create a new function for each new user. Is there another way I can do this so that I can limit the requirements to a single function? My hope is to be able to loop through each token (or user-id to fetch said token) and check their calendar events in said loop. I like this because it means that any new users that are added will not need a new function created solely for them, which means less administration overhead. It's important to note that this is designed to run for < 10 users at a time and < 50 appt's per day. We will be running the function once per day at a certain time.



If you're wondering, our use case is to be able to look at multiple users' calendars in our organization and then be able to send reminder SMS messages to numbers included in each appointment in each users' calendar.










share|improve this question

























    up vote
    0
    down vote

    favorite












    TL;DR: I'm not sure how to go about accessing multiple users' in our organization's calendar resources (read only), and if it's possible to do so in a single Azure Function. Any guidance to what I can do would be much appreciated.



    As the title says, I'm looking for a way to access multiple user's resources on their behalf using Azure Functions and the Microsoft Graph API. Currently I have a little bit of experience using the Auth Token binding, but so far I've only been able to use a single user-id as an input to fetch the token they'd consented access to. I'd like to be able to access multiple users' tokens in a single function, regardless of if I need to use the Auth Token binding or coding in some other method of obtaining and retrieving said tokens. Currently the only way that I can see making this work with the Auth Token binding would be to create an Azure Function for each of our users individually, which would require an administrator to create a new function for each new user. Is there another way I can do this so that I can limit the requirements to a single function? My hope is to be able to loop through each token (or user-id to fetch said token) and check their calendar events in said loop. I like this because it means that any new users that are added will not need a new function created solely for them, which means less administration overhead. It's important to note that this is designed to run for < 10 users at a time and < 50 appt's per day. We will be running the function once per day at a certain time.



    If you're wondering, our use case is to be able to look at multiple users' calendars in our organization and then be able to send reminder SMS messages to numbers included in each appointment in each users' calendar.










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      TL;DR: I'm not sure how to go about accessing multiple users' in our organization's calendar resources (read only), and if it's possible to do so in a single Azure Function. Any guidance to what I can do would be much appreciated.



      As the title says, I'm looking for a way to access multiple user's resources on their behalf using Azure Functions and the Microsoft Graph API. Currently I have a little bit of experience using the Auth Token binding, but so far I've only been able to use a single user-id as an input to fetch the token they'd consented access to. I'd like to be able to access multiple users' tokens in a single function, regardless of if I need to use the Auth Token binding or coding in some other method of obtaining and retrieving said tokens. Currently the only way that I can see making this work with the Auth Token binding would be to create an Azure Function for each of our users individually, which would require an administrator to create a new function for each new user. Is there another way I can do this so that I can limit the requirements to a single function? My hope is to be able to loop through each token (or user-id to fetch said token) and check their calendar events in said loop. I like this because it means that any new users that are added will not need a new function created solely for them, which means less administration overhead. It's important to note that this is designed to run for < 10 users at a time and < 50 appt's per day. We will be running the function once per day at a certain time.



      If you're wondering, our use case is to be able to look at multiple users' calendars in our organization and then be able to send reminder SMS messages to numbers included in each appointment in each users' calendar.










      share|improve this question













      TL;DR: I'm not sure how to go about accessing multiple users' in our organization's calendar resources (read only), and if it's possible to do so in a single Azure Function. Any guidance to what I can do would be much appreciated.



      As the title says, I'm looking for a way to access multiple user's resources on their behalf using Azure Functions and the Microsoft Graph API. Currently I have a little bit of experience using the Auth Token binding, but so far I've only been able to use a single user-id as an input to fetch the token they'd consented access to. I'd like to be able to access multiple users' tokens in a single function, regardless of if I need to use the Auth Token binding or coding in some other method of obtaining and retrieving said tokens. Currently the only way that I can see making this work with the Auth Token binding would be to create an Azure Function for each of our users individually, which would require an administrator to create a new function for each new user. Is there another way I can do this so that I can limit the requirements to a single function? My hope is to be able to loop through each token (or user-id to fetch said token) and check their calendar events in said loop. I like this because it means that any new users that are added will not need a new function created solely for them, which means less administration overhead. It's important to note that this is designed to run for < 10 users at a time and < 50 appt's per day. We will be running the function once per day at a certain time.



      If you're wondering, our use case is to be able to look at multiple users' calendars in our organization and then be able to send reminder SMS messages to numbers included in each appointment in each users' calendar.







      azure azure-web-sites microsoft-graph azure-functions function-binding






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 4:16









      cody.codes

      286413




      286413






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          I see two main directions you could try:



          • Create an additional Azure Function that extracts all relevant user IDs and pass each ID to the second Azure Function (if you wish to continue using Token From ID).

          • You might be able to use OAuth's Client Credentials flow, meaning a dedicated token for the Azure Function that can be used to access the required resources. This might allow you to both iterate over the list of relevant users and extract the required information for each user in the same function.

          Hope it helps!






          share|improve this answer




















          • Hi Itay! Thanks for your answer; I do like your first direction, and after doing a bit of research and experimentation I was able to successfully pass in a user ID via an HTTP route; now I can actually use a function that grabs user IDs and calls a second Azure function for each of the users to be able to have their events read.
            – cody.codes
            Nov 12 at 1:04










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245788%2fusing-a-single-azure-function-to-access-multiple-users-resources-on-their-behal%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          I see two main directions you could try:



          • Create an additional Azure Function that extracts all relevant user IDs and pass each ID to the second Azure Function (if you wish to continue using Token From ID).

          • You might be able to use OAuth's Client Credentials flow, meaning a dedicated token for the Azure Function that can be used to access the required resources. This might allow you to both iterate over the list of relevant users and extract the required information for each user in the same function.

          Hope it helps!






          share|improve this answer




















          • Hi Itay! Thanks for your answer; I do like your first direction, and after doing a bit of research and experimentation I was able to successfully pass in a user ID via an HTTP route; now I can actually use a function that grabs user IDs and calls a second Azure function for each of the users to be able to have their events read.
            – cody.codes
            Nov 12 at 1:04














          up vote
          3
          down vote



          accepted










          I see two main directions you could try:



          • Create an additional Azure Function that extracts all relevant user IDs and pass each ID to the second Azure Function (if you wish to continue using Token From ID).

          • You might be able to use OAuth's Client Credentials flow, meaning a dedicated token for the Azure Function that can be used to access the required resources. This might allow you to both iterate over the list of relevant users and extract the required information for each user in the same function.

          Hope it helps!






          share|improve this answer




















          • Hi Itay! Thanks for your answer; I do like your first direction, and after doing a bit of research and experimentation I was able to successfully pass in a user ID via an HTTP route; now I can actually use a function that grabs user IDs and calls a second Azure function for each of the users to be able to have their events read.
            – cody.codes
            Nov 12 at 1:04












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          I see two main directions you could try:



          • Create an additional Azure Function that extracts all relevant user IDs and pass each ID to the second Azure Function (if you wish to continue using Token From ID).

          • You might be able to use OAuth's Client Credentials flow, meaning a dedicated token for the Azure Function that can be used to access the required resources. This might allow you to both iterate over the list of relevant users and extract the required information for each user in the same function.

          Hope it helps!






          share|improve this answer












          I see two main directions you could try:



          • Create an additional Azure Function that extracts all relevant user IDs and pass each ID to the second Azure Function (if you wish to continue using Token From ID).

          • You might be able to use OAuth's Client Credentials flow, meaning a dedicated token for the Azure Function that can be used to access the required resources. This might allow you to both iterate over the list of relevant users and extract the required information for each user in the same function.

          Hope it helps!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 7:34









          Itay Podhajcer

          1,067212




          1,067212











          • Hi Itay! Thanks for your answer; I do like your first direction, and after doing a bit of research and experimentation I was able to successfully pass in a user ID via an HTTP route; now I can actually use a function that grabs user IDs and calls a second Azure function for each of the users to be able to have their events read.
            – cody.codes
            Nov 12 at 1:04
















          • Hi Itay! Thanks for your answer; I do like your first direction, and after doing a bit of research and experimentation I was able to successfully pass in a user ID via an HTTP route; now I can actually use a function that grabs user IDs and calls a second Azure function for each of the users to be able to have their events read.
            – cody.codes
            Nov 12 at 1:04















          Hi Itay! Thanks for your answer; I do like your first direction, and after doing a bit of research and experimentation I was able to successfully pass in a user ID via an HTTP route; now I can actually use a function that grabs user IDs and calls a second Azure function for each of the users to be able to have their events read.
          – cody.codes
          Nov 12 at 1:04




          Hi Itay! Thanks for your answer; I do like your first direction, and after doing a bit of research and experimentation I was able to successfully pass in a user ID via an HTTP route; now I can actually use a function that grabs user IDs and calls a second Azure function for each of the users to be able to have their events read.
          – cody.codes
          Nov 12 at 1:04

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245788%2fusing-a-single-azure-function-to-access-multiple-users-resources-on-their-behal%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto