Comments (18)
Thank you @stack111
from azuremapscodesamples.
Please see #19 as well.
from azuremapscodesamples.
I have asked one of our developers to look into this question. We will report back shortly. Also note that the forums or the Azure support team is a much better place to ask these types of questions.
from azuremapscodesamples.
@sujayvsarma, the called function will configure the OAuth credentials to acquire an access token. You can visit Azure Active Directory Authentication libraries to take a look at the list of supported authentication libraries. Also the documentation on how to manage authentication in Azure Maps will help you understand on how to set up Azure AD app registration. Quick question, what language do you want to implement the function in?
from azuremapscodesamples.
I have already looked at the documentation you pointed to. They were either confusing or inadequate. I had raised a bug on them which they seem intent on closing instead of addressing.
Which is why I raised this issue hoping that developers will help me with the problem.
Language would be C#.
from azuremapscodesamples.
from azuremapscodesamples.
OMG. Then this request is a waste of time already?
from azuremapscodesamples.
You can also reach out to the Azure support team as well: https://azure.microsoft.com/support/options/ if you want more in-depth support.
from azuremapscodesamples.
@sujayvsarma, below is a sample async function deployed as an azure function, it acquires the access token. Hope this helps.
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
// Replace the tenant name
var authenticationContext = new AuthenticationContext("https://login.microsoftonline.com/<tenant_name>", false);
// Config for OAuth client credentials
ClientCredential clientCred = new ClientCredential("<Replace with client ID>", "<Replace with client secret>");
AuthenticationResult authenticationResult = await authenticationContext.AcquireTokenAsync("https://atlas.microsoft.com/ ", clientCred);
string token = authenticationResult.AccessToken;
return (ActionResult)new OkObjectResult(token);
}
from azuremapscodesamples.
from azuremapscodesamples.
This is the same function we are calling in our examples.
from azuremapscodesamples.
I am satisfied with the answer Ricky provided per this reply. Specifically:
A critical part of the service that you create is including your secret token. We can't expose our service and make it reusable as there would not be a secure way to get your secret into it. Also, a lot of companies add a lot of custom logic to their service and often run the service in the same domain as their application.
With that, as well as your code sample, I am happy to close out this issue.
from azuremapscodesamples.
Glad to hear that.
from azuremapscodesamples.
@walsehgal - One more question --
How do I correctly configure things between:
- Azure Maps Application (from Create Resource > Azure Maps)
- Azure App Service (that hosts the Maps stuff)
- Azure AD
Basically, how do I correctly register these with each other and in my Azure AD so that I can get a valid token? I tried to set it up from what I thought was logical, I ended up getting a token as well (from the code sample), BUT, Atlas Service API refused to honour the token (HTTP 403). So, I've done something wrong somewhere. But the terminology is far too confusing to attempt to resolve it.
Please help.
from azuremapscodesamples.
@sujayvsarma, you are assigning the role to a different service principal than the one you have the token for. Please make sure you get the token for the same service principle and then add it to RBAC.
from azuremapscodesamples.
@walsehgal - Basically here is what I went through:
First, I had only the Azure Maps Application (freshly created). Then from your sample code, I realized I need an App Secret. So I went to Azure AD and saw that (i) it was not registered there as an enterprise app and there was no way to do it.
So, I created a new App Registration (Azure AD > App Registrations > New), set the URLs to my local development URLs (localhost stuff). I gave it user_impersonate
delegated permissions to Azure Maps
API (from API Permissions). Then, I generated a secret for this application.
I used the Client ID and Secret from the App registration I had created to get the token using your sample code. It is for this token that I keep getting the HTTP 403 messages in the console logs. I can see that the call to the code is normal and seems to work fine -- My application is an ASP.NET Core 3 MVC application and I have implemented it as an Action in one of the Controllers instead of as a separate Azure function.
from azuremapscodesamples.
PS: My interest in getting this flow working is currently academic. Azure Maps API does not return accurate or usable information for India and for the foreseeable future is not a viable solution for my needs.
from azuremapscodesamples.
Hi Sujay, point taken we need to improve our content and simpify the experience :). We definitely appreciate the feedback. Everything you described above appears accurate. However to grant access; what's missing in your steps is to add a role assignment for the application.
You have created role assignments for other service principals but the token being sent doesn't represent any of the service principals.
Alternativily we support groups in Azure AD directory. If it's easier to add your service principal to the group you can do that in the Azure AD directory. Finally, then adding the group as a role assignment.
WRT: India map data, if you want to be more specific we have a tool which can capture the problems and get them fixed.
from azuremapscodesamples.
Related Issues (20)
- Unable to interact with WebGLLayer HOT 2
- Sample to Calculate an Average Over a Cluster's Property? HOT 2
- Wrong canvas size upon initial render HOT 6
- Fill Address Form with Autosuggest Uncaught (in promise) TypeError: Failed to fetch running sample code HOT 3
- Map 3.0.0 Preview 8-->10 Drawing Manager Issues after changing the map style HOT 1
- Drawing Manager Event Fires for an drawn shape when clicking outside of the shape HOT 1
- Map Popup with HTML Bootstrap 5 Components wont Interact HOT 3
- [How To] How to generate tokens without RBAC? HOT 2
- [HowTo] Bring back old map styles HOT 1
- atlas.io.read does not load icons from the kmz file HOT 1
- New layers... who dis? HOT 5
- Missing npm package azuremaps-maplibre-gl HOT 5
- Missing supported type on BoundingBox.fromData HOT 4
- invalid HTML in sample HOT 1
- Usage of the ['id'] data expression HOT 4
- Choosing popup locale for formatting data HOT 3
- Changing map style changes layering HOT 10
- I am unable to access some resources. HOT 3
- Three.js Sample broken HOT 3
- Searching for boundaries Manhattan NY USA seems incorrect. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azuremapscodesamples.