How to get viewer email in Google Data Studio Connector? - google-data-studio

I created a Google Data Studio Connector that gets data from an rest api I built. Is there a way to get the email address of the Google Account that is seeing the report, which can be different from the user that created the report and datasource?
I can authenticate my connector with my credentials to access the datasource (through OAuth), but I need to be able to get the email of the viewer of the report.
I know this could be resolved by sharing the Data Studio Connector with the viewers, so each viewer can authenticate when creating the datasource, but I don't want to share the Connector with all my viewers, to be sure there's only one person managing the datasource configuration.
Thanks!

https://developers.google.com/apps-script/reference/base/session#geteffectiveuser
// Log the email address of the user under whose authority the script is running.
var email = Session.getEffectiveUser().getEmail();
Logger.log(email);

Related

Unable to Connect a salesforce named credentials with quickbooks companies

I have a requirement to connect a new QuickBooks company to salesforce.
the setup of sync invoices and payments from salesforce to QuickBooks is done and working correctly.
recently we have had a new company sync data in that company.
we are doing this using named credentials and use different named credentials for each company.
but after putting the required information in the named credential the option to choose a company is not appearing and it directly says authenticated.
Not sure it happens because of any new update from quickbook
Check below Images
All Named credential
Named credential
Thanks, In advance

PowerApps allow guest users to connect to Azure SQL database with AAD integrated feature

I have a specific problem to which I couldn't find any answer online.
The situation is the following:
We created a Canvas app that connects to the Azure SQL database. We set the connection type to be AAD integrated.
Users that are members of the AD can see the data in the app, but guest users, even though we gave them all the rights and PowerApps plan, cannot see the data. they recieve the same authorization window as members, but when they click on allow, the app starts but no data is being pulled from the SQL database.
When we try to connect directly to the Azure SQL database with the guest user email and credentials (via SQL server management studio), everything works as expected and the guest can see all the tables.
When we use implicitly shared connection (with SQL server authentification), guests can see the data, but we need to use AAD integrated due to its security.
So far we tried:
Changing PA environment from sandbox to production
Adding special permissions in SQL database like database owner etc
Trying out different AAD guest user settings, eq- setting that guest users have the same privileges as members (picture below).
Nothing seems to work. I would be more than happy if you could tell me how to make this work or even push me in the right direction.
I've reproduced your problem in my side. Here's my experience.
After assigning powerapp license(I use O365 E5 here) to guest account and share the app to this account, I can visit the app but can't see the data in the table. I assume that it resulted from the connector hasn't been shared, but it's true that this connector can't be shared because of no 'share button'.
Then I tried to add access policy to my guest account with these two sql:
CREATE USER [tiny-wa_outlook.com#EXT##xx.onmicrosoft.com] FROM EXTERNAL PROVIDER;
GRANT SELECT ON dbo.tinyTest TO [tiny-wa_outlook.com#EXT##xx.onmicrosoft.com];
Pls note here, I used the User Principal Name here(can find the principal name in azure ad->users), I also tested to use 'tiny-wa#outlook.com' in the sql but after executing successfully, it didn't work.
So I think you can try to use the sql above to add your guests accounts and make them can access the powerapp.
Here's some related docs:
create contained users mapped to azure ad identities
Share app resources
add table permission to user
==========================UPDATE==========================
Share my experience of this troubleshot.
First I need to create a power app but I found that after creating the connector with sql server azure ad authentication, it can't connect to the sql server, the error message is like 'Credentials are missing or not valid. inner exception: The credentials provided for the SQL source are invalid', solution is add my admin account as sql server instance Active Directory Admin.
Then I choose a table and successfully create a sample app. With the creating account, I can visit the app but other accounts can't. Here needs to share the app and it's related connectors to other users. But other accounts still can't reach the app because of no license. Because sql server connector is premium connector, so I assign O365 E3 license here. I met an error when assign license, the user's 'Usage location' can't be null or it can't assign license in M365 admin center.
Then I met similar error with Op, the difference is that both member account and guest account can't see the data in app. I try to find the way to share the connector to these uses but failed, I haven't made sure if those connectors without share button can be shared to others. So I have no options to study if this kind of connectors are authenticated in other ways so they don't need to be shared at all.
Next actions is using the account which used to create the sql server and database to sign in database and execute the sqls above.
Then the member account can see data in the power app while the guest account can't see. The reason is I used xx#outlook.com as the parameter in the sql, when I used xx_outlook.com#EXT##xx.onmicrosoft.com, it worked finally.
Hope this can also help you.
===================================================
For creating my demo app: First, I'm sure my environment isn't a sandbox(the environment in the screenshot below). And I think it's easy to create a demo app, and my app is simple, just choose to create an app from data and then select sql server as the connector, next I choose auzre ad auth and click the connector, enter server name and database name then choose a table, after that my app has created. That table has one row of data so when I signed in the app with the creating account, I see it in the screen while other accounts(member or guests) can't.
My sql server instance and database are created long time ago, but I'm sure I followed this tutorial to create them.
This appears to still be a limitation to access to Azure SQL via PA connector for guest users:
https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Azure-SQL-to-PowerApps-Connector-AAD-doesn-t-work-for-guest/idi-p/1637817
If the "guest" does NOT have a PowerApps Per-App/Per-User plan, they cannot use your PowerApps with SQL data source (Note: SQL is a premium connector).
Determine exactly which type of license the guest has. Then, either your organization or the guest (or guest's org) must purchase one of these licenses. $5/$10/$20 per month depending on your use case.
REF

Refresh credentials in Google Data Studio Community Connector

When an owner of a datasource logs in to connector for that datasource (user+pwd) she can use that datasource to populate reports.
When the owner changes her password on the source data platform, how can the owner then update her credentials in the connector?
I didn't find a method to refresh credentials other than revoking access to the connector entirely.
Additional question: Is there a way to create multiple instances of a connector for a data source (user+pwd) and use different credentials?
Currently the only way to update third party credentials for a Community Connectors is to revoke access to the connector and then adding it again.
It isn't currently possible to have multiple instances of a Community Connector with different sets of third party credentials.

Why "Data credentials" can't be blank for community connector when using service account to access underlying bigquery data?

I built a community connector that uses service account to access the bigquery service and it works fine. However, when I was looking at Service.getEffectiveUser() I noticed that this always resolved to my user even when accessing the published report without any session. When I set the "Data credentials" from "Owner" to "Viewer" it asks to login. However, I plan to use a separate token based authentication by passing the token in the connector url parameter. So, is there a way to execute the community connector script without setting Data credentials to Owner or Viewer? Note that I already return AuthTypes.NONE for getAuthType.
Note that this community connector will not be published and will only be used for a SAAS application where the report will be embedded and accessible to the users of the SAAS application.

Reporting Services - how to email a report without a fixed schedule

I'm planning a winform which will let the user preview a report (generated with Reporting Services) and then the user can send the report to certain persons by clicking a button in the form.
I know that reports can be distributed via email using subscriptions, but the problem is that a subscription requires a fixed schedule (once a week/month, etc.), and in my case the report should be sent anytime the user clicks the button - there is no defined schedule.
Is it possible to define a subscription for a report without a schedule?
What is the best way to send a report via email on demand of the user?
Thanks.
(I'm using Sql Server 2008, Visual Studio 2008.)
Simplest way:
Call the ReportServer web service to fetch the report into your app.
Send it from your app
Unrelated: the ReportViewer Control may be more useful in your app

Resources