- Newest
- Most votes
- Most comments
There’s a blog here which talks about exactly what you’re looking to do.
To assume an AWS IAM role from an Azure Function, you can follow these steps:
-
Set up cross-account access in AWS: First, you must create an IAM role in AWS that your Azure Function can assume. This role must have a trust relationship with an identity provider that supports SAML 2.0 (like Azure AD). You'll define a policy allowing you to perform the actions you want in AWS (ex. ec2:DescribeInstances)
-
Configure Azure AD for SSO to AWS: In Azure AD, you'll set up a single sign-on (SSO) to AWS. This involves configuring Azure AD as a SAML identity provider in AWS. You'll download the metadata XML from Azure and upload it to AWS to establish trust.
-
Assign users or groups in Azure AD: Assign the Azure AD users or groups with access to assume the AWS IAM role. These are typically the identities associated with your Azure Functions.
-
Acquire Azure AD token: Your Azure Function needs to authenticate with Azure AD to get a SAML assertion token. You can use the Microsoft identity platform (Azure AD for developers) to obtain tokens.
-
Assume the AWS role using the SAML assertion: Once you have the SAML assertion, you use the AWS Security Token Service (STS) AssumeRoleWithSAML API to exchange the SAML assertion for AWS temporary security credentials.
-
Use AWS credentials in your Azure Function: Your Azure Function can make authenticated requests to AWS services with temporary security credentials (access key ID, secret access key, and session token).
As Oleksii Bebych explains, it is better to use an identity federation.
FYI. An example using VMs was recently posted on the AWS blog.
Another approach could be to create an api gateway in aws with a lambda making the call, which the azure function can consume. Thought involving a bit more manual work, you separate the logic clearly into e.g. a lambda function, protected by either IAM auth or another lambda authorizer.
Also this stipulate clear contract between two different cloud vendor sources and makes the interaction more visible.
Relevant content
- asked 10 months ago
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 years ago
Thanks for your and all replies! This answer resolved my issue, however step-by-step instructions in the article could be more precise.