Before we begin, it’s essential to understand what API security is. API security refers to mechanisms and protocols used to protect APIs from misuse – primarily unauthorized access or manipulation. For instance, by limiting what specific users, developers or apps can do on the system. Most importantly, API security ensures that sensitive data remains safe from threats.
Configuring API Security in Microsoft Power Platform
There are several ways to configure API security in Microsoft Power Platform, via:
- Azure AD and OAuth
- API Permissions
- Custom API Connectors
Using Azure AD and OAuth
Azure Active Directory (Azure AD) is used for authenticating users and controlling access to resources. Securely invoking an API often involves making use of OAuth. OAuth facilitates providing clients with ‘secure delegated access”’ to server resources on behalf of a resource owner.
Implicitly, in the OAuth 2.0 protocol, a client application can request an access token from Azure AD, which can then be used to make API invocation requests on behalf of the user.
Although OAuth is not covered by the PL-400 exam syllabus, it is important to understand for deploying secure applications.
API Permissions
It is important to configure user and system permissions to ensure that unauthorized access to API does not occur. One can set the permissions of various API permissions from within the Power Apps portal, in the ‘Admin center’.
The process involves:
- Selecting an app from the ‘Apps’ list.
- Using the ‘Settings’ menu, you can navigate to ‘Permissions’.
- Here, you can specify roles, users, and what kind of rights they have to the app and its APIs.
Custom API Connectors
Microsoft Power Platform allows you to create custom connectors to your APIs. This requires setting up API permissions in Azure AD.
To create a custom connector, use the PowerApps main menu:
- Select ‘Data’ > ‘Custom connectors’.
- Click on ‘New custom connector’.
- Fill out the information on the ‘General’ tab.
- On the ‘Security’ tab, you can choose from four different types of authentication: None, API Key, Basic, and OAuth 2.0.
Using OAuth 2.0 with Your Custom Connector
If selecting OAuth 2.0, you will be asked to input the following:
- Client id
- Client secret
- Authorization URL
- Token URL
- Refresh URL
- Redirect URL
After setting up the security for your custom connector, you will then define the ‘Definition’ and ‘Test’ for your connector.
API security is a critical aspect of Microsoft Power Platform. This post covered configuring API security using Azure AD, OAuth, API Permissions, and Custom API Connectors – all integral parts to this security process. Remember, mastery of these skills not only ensures your applications are secure but also broadens your knowledge for the PL-400 Microsoft Power Platform Developer exam.
In conclusion, it always makes sense to follow Microsoft’s best practices for configuring security, as doing so will ensure the secure functioning of your apps!
Practice Test
True or False: You need to deploy Azure AD to configure API security in Microsoft Power Platform.
- True
- False
Answer: False.
Explanation: Azure AD is not necessary to configure API security. It is one way to manage users and group access, but it is not necessary for API security.
Which of the following is not a security measure to protect APIs in Microsoft Power Platform?
- a. Oauth 0
- b. SSL/TLS
- c. Network Firewalls
- d. Cookies
Answer: d. Cookies
Explanation: Cookies is not a direct measure for protecting APIs. They are typically used for session handling.
True or False: Microsoft Power Platform APIs are by default public.
- True
- False
Answer: False.
Explanation: Microsoft Power Platform APIs are not public by default. The APIs could be set as private or public based on the configuration.
Which of the following security protocol Microsoft Power Platform use for its APIs?
- a. API-key security
- b. OAuth 0
- c. Basic Authentication
- d. Digest Authentication
Answer: b. OAuth 0
Explanation: Microsoft Power Platform uses OAuth as its primary method of authentication for APIs.
True or False: SSL/TLS is necessary for securing API in Microsoft Power Platform.
- True
- False
Answer: True.
Explanation: Secure Sockets Layer (SSL)/Transport Layer Security (TLS) ensured that the data transmitted between systems are encrypted and secure.
On which server does an access token validation occur in OAuth 0 protocol?
- a) Resource Server
- b) Client Server
- c) Authorization Server
- d) All of the above
Answer: a) Resource Server
Explanation: The access token is sent to the resource server for validation. If valid, the requested service is granted.
Which HTTP method should you restrict in API security management?
- a) GET
- b) POST
- c) DELETE
- d) All of the above
Answer: c) DELETE
Explanation: The DELETE method can be used to delete data, and large scale deletions can cause significant damage to a service/node if abused.
True or False: Client certificates provide an extra level of security for your API.
- True
- False
Answer: True.
Explanation: Client certificates are used as authentication for the client making a request which provides an additional layer of security.
Which of the following should be avoided in API security?
- a) Hardcoding sensitive information
- b) Using third-party libraries
- c) Using HTTPS
- d) Using firewalls
Answer: a) Hardcoding sensitive information
Explanation: Hardcoding sensitive information in API’s can make it easily accessible to hackers.
True or False: Microsoft Power Platform uses AES Encryption to secure data.
- True
- False
Answer: False.
Explanation: Microsoft Power Platform uses SSL/TLS for encryption not the AES encryption.
Microsoft Power Platform’s API management has which of the following main features?
- a) SOAP & REST APIs management
- b) API versioning
- c) Policy enforcement
- d) All of the above
Answer: d) All of the above
Explanation: Microsoft Power Platform’s API management includes all these features which allows for better organization, control and security over APIs.
True or False: API management’s security policies can be extended by writing custom code.
- True
- False
Answer: True.
Explanation: Microsoft Power Platform allows flexibility to add additional security layers with custom code.
True or False: Enabling CORS in API provides security against cross site scripting attacks.
- True
- False
Answer: False.
Explanation: CORS (Cross-Origin Resource Sharing) allows cross-origin requests but it does not specifically protect against cross site scripting (XSS) attacks.
Which of the following is used as identification for APIs in OAuth 0 protocol?
- a) Access token
- b) Refresh token
- c) Id token
- d) JWT token
Answer: a) Access token
Explanation: Access token is issued by the authorization server, is sent with each request to identify the API.
True or False: Securing API in Microsoft Power Platform requires knowledge of .NET programming.
- True
- False
Answer: False.
Explanation: Securing API in Microsoft Power Platform does not necessarily require .NET programming knowledge, but having understanding of programming concepts can help in configuring API security.
Interview Questions
What is the main aim of API security in Microsoft Power Platform?
The primary aim of API security in Microsoft Power Platform is to provide appropriate access by verifying the identity of users or systems and authorizing them to access the required data and protect the API from malicious attacks.
What is the role of OAuth 2.0 in API security for Microsoft Power Platform?
OAuth 2.0 is an authorization framework that allows applications to obtain limited access to user accounts on an HTTP service, enabling third-party applications to gain appropriate access without exposing the user’s password.
What does it mean to “throttle” an API in Microsoft Power Platform?
Throttling an API is exclusively intended to preserve the performance and availability of the API. It allows limiting the usage of APIs by setting up a fixed number of requests over a certain period from a specific user.
Can we customize the API throttling limits in the Power Platform Developer?
No, customizing API limits per user is solely controlled by Microsoft and can’t be updated by the developers.
How does Microsoft Power Platform handle Cross-Origin Resource Sharing (CORS)?
By default, due to security reasons, browsers block AJAX requests across domains. Microsoft Power Platform handles CORS at the server level by adding specific CORS headers to the responses, allowing secured cross-domain communications.
Can we use Azure Active Directory (Azure AD) for authorizing API calls in Power Platform?
Yes, Azure AD can be used to authorize API calls in Power Platform. It uses OAuth 2.0 protocol to authenticate the API calls.
What is the purpose of using the Client Credentials flow in Azure AD?
The Client Credentials flow in Azure AD is used when the application is acting as itself without any user interaction. This is typically used for server-side processes.
What does implicit grant flow mean in configuring API security?
Implicit grant flow was designed for applications that are implemented directly on the user’s device, such as JavaScript applications, which can’t keep a client secret confidential.
What are Managed Identities in the context of Azure API Management?
Managed Identities provide an Azure AD identity to Azure resources, which can be used to authenticate to services that support Azure AD authentication.
How does Microsoft encrypt data at rest in Power Platform?
Microsoft uses several strong encryption mechanisms such as BitLocker and Azure Storage Service Encryption (SSE), for encrypting data at rest.
Why are API keys considered less secure for authentication?
API keys are considered less secure because they are static and don’t expire, which means if they are compromised, an attacker can have potentially limitless access unless the keys are revoked and replaced.
Why are JSON Web Tokens (JWTs) used in API security?
JWTs are used in API security as they allow the transmission of security claims between the parties involved in API calls in a secure way. They contain the necessary information for the server to validate the user.
What is Multi-Factor Authentication (MFA) in API security?
Multi-Factor Authentication (MFA) is a security system that requires multiple methods of authentication from separate categories of credentials to verify the user’s identity for a login or other transaction.
What part does SSL/TLS play in API security in Power Platform?
SSL/TLS protocols are used to secure the data transmission between the user’s device and the server. They are responsible for data integrity, encryption, and authentication.
How does IP filtering contribute to API security in Power Platform?
IP filtering allows you to limit the IP addresses that can access your API endpoint. This can strengthen your API security by only allowing access from trusted IP addresses.