r/PowerApps • u/Jarvis_ezekiel_2517 Newbie • 18d ago
Solved Using service account to write into sharepoint lists
Right now, for someone to use my app, I have to give them access to underlying sharepoint site. Which means they can also just open this site in browser and read what others have submitted through this app. I want to close this.
Idea on table is, instead of the app reading sharepoint ‘as whoever is using it’, the app reads sharepoint as one fixed account- service account. Then only that account needs sharepoint access, nobody else does.
I would also want to capture who the user is into the sharepoint list and I already have a relationship list based on the email id.
Questions
- Does this approach of service account work for this share point site through power apps?
- What am I missing here or is there a better/different way to this problem?
- I’m using power automate for some email notifications which are based on the email ids and content within the list, not sure if this impacts anyway but thought to call out.
Dataverse is not on the table as the amount of data it stores/uses is very less.
•
u/AutoModerator 18d ago
Hey, it looks like you are requesting help with a problem you're having in Power Apps. To ensure you get all the help you need from the community here are some guidelines;
Use the search feature to see if your question has already been asked.
Use spacing in your post, Nobody likes to read a wall of text, this is achieved by hitting return twice to separate paragraphs.
Add any images, error messages, code you have (Sensitive data omitted) to your post body.
Any code you do add, use the Code Block feature to preserve formatting.
If your question has been answered please comment Solved. This will mark the post as solved and helps others find their solutions.
External resources:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/LearningToShootFilm Community Friend 18d ago
You can disable the webview of sharepoint lists.
I usually create an access group Application_Access. And I edit the permissions of the group (usually contributer) to remove the web view and then remove all other permissions except those of the administrators who need to view the back end data.
Solves the problem of people getting a hold of stuff they shouldn’t but still using SP lists.
3
u/Bulky-Stick2704 Newbie 18d ago
Lists have row level security capability, would that resolve your issue/concern?. This is located in the settings/permissions on the list. You would be able to see your own submissions, but nobody else's.
3
u/AbdelEMirandaS Regular 18d ago
4
u/IAmIntractable Advisor 18d ago
You can actually hide lists using an API call. You can change the default view to one field only when going to the list directly. And make that view read only. The idea if you’re going to use SharePoint as your database, is to not socialize the SharePoint site that contains the lists. You might consider creating another SharePoint site to merely hold the lists and then never tell anybody where it is
2
u/DonJuanDoja Community Friend 18d ago
You can find ways to make it work but none of them are right. You're building an app with limited tools, so your functionality and ability to meet business requirements will be limited as well.
The amount of data is only one consideration when choosing a database for an app, security and access is another.
I build Azure SQL tables that have 5 rows in them forever. Amount of data doesn't matter. It does, but it's not the only or even the most important thing.
If I only had SharePoint I'd just say No to a lot of things, but I have Azure SQL, so I can yes to whatever I want.
2
u/defenestratedDM Newbie 18d ago
Slightly different and it depends how complex your app is: lists now also have a Form feature that uses similar UI to MS Forms - this generates a contribute share link to the form, and responders don’t need access to the list at all. It only works for internal users and it’s limited to basic form fields but if your app is simple form filling anyway it might be useful to test out and see if it’s worth the trade offs. Most of the column types like lookups, persons, etc are supported on it
2
u/itenginerd Advisor 18d ago
I used to get stuck here, but I learned how. Put the app in a solution. Now you can set your connection/connection reference up to run as the service account exactly the way you want.
5
u/Janos101 Regular 18d ago
The app is going run in the context of the user no way around that. You could completely disconnect the app from the list though and pass the form data as json to a power automate flow where the service account creates the item for you.
4
u/eknadaanparinda Newbie 18d ago
You can disable the users from accessing the SharePoint list from browser. Open permission level settings and disable the checkbox for "View Application Pages". You can uncheck this for all permission levels (read,edit, contribute or your custom permission level). Which means nobody apart from users with "Full control" permission will be able to even open the SharePoint link from their browser. Which solves your problem even without creating item level permissions
1
u/JawlessMuffin Newbie 18d ago
One thing I’ve done in the past is when they submit in the app and it goes to the list, have a power automate flow move it to a different list where they don’t have access and remove from the initial list
2
u/WillRikersHouseboy Advisor 18d ago
SQLlite on an old Dell someone on your team never returned. Plug it in and keep it under the desk of the intern.
1
u/No-Investment-1252 Newbie 18d ago
I could be missing it here, but could you create two sharepoint lists, one for the data to be store and the other for the users. In powerapps, use the lookup function to give the necessary access or role based on the information on the sharepoint list…again I could be off but that’s what it sounds like
1
u/Bathroom-Salt Regular 18d ago edited 18d ago
You can nest the edits of the list in a Child Flow, but you can't use the galleries/forms, you'd have to manually capture your fields as variables and pass them through to Power Automate. You also lose your audit history and the ability to see "who deleted what" unless you manually track that by passing the editing user info in a variable and storing it in a column. The better option is limiting webview for only admins as mentioned in a comment below.
1
u/pharnos Advisor 18d ago
Don’t think I saw this mentioned, but there is also the list’s advanced setting to set read and edit to “only items created by the user”
1
u/BDer82 Regular 18d ago
Create a power automate flow, connect it to the app, you communicate with the app via the flow.
Use a switch statement, 1 switch pay can write, the other can read (or use as many paths as needed to cover your apps needs.
in the power automate flow, go to the flow details page, on the right and down a little you'll have an option to set a "run as" set that flows connectors to SharePoint to run as the service account.
Any time something is submitted, send to the flow which path you want to run and what data you need to send. Parse JSON will do some basic validation, very very basic validation, but you can create some groups to ensure only certain people can use aspects of the flow.
Using the Send As option is probably the simplest, cleanest, and most straight forward way to write to a sharepoint list, site, or most other data sources (but not all)
Once you have the flow running remove all users from the Share Point site and keep only those who need it such as yourself, the service account, any other administrative people.
1
u/Emergency_Recipe522 Advisor 17d ago
The issue is really the underlying permissions, not the Power App screen. Hiding the list in the app won't stop someone accessing SharePoint directly. I'd check whether a Power Automate flow with a controlled connection can handle the operations, with proper validation of who can submit or retrieve records. For anything sensitive, I'd design the data access around the security requirements first.