| 1068 | 1068 | | | Lifetime | 5 minutes | |
| 1069 | 1069 | | | Audience | What the job asks for; `https://g1t.sh/<owner>` when it asks for none | |
| 1070 | 1070 | | |
| 1071 | + | A job without `id-token: write` has no `ACTIONS_ID_TOKEN_REQUEST_URL`, so |
| 1072 | + | a login action says it cannot find one; a token asked for anyway is |
| 1073 | + | refused with `403` and `This job has no OIDC token`. |
| 1074 | + | |
| 1075 | + | ### Reaching your cloud |
| 1076 | + | |
| 1077 | + | Asking for the token goes to `api.g1t.sh`, which every job reaches. Trading |
| 1078 | + | it for credentials goes to your cloud's token service, which a job reaches |
| 1079 | + | only when its project allows it (see [what a job can reach](#what-a-job-can-reach)). |
| 1080 | + | Add the hosts under **Settings → Guardrails → Workflow-only domains**, |
| 1081 | + | limited to the workflow and environment that deploy, so agents and other |
| 1082 | + | workflows never reach them: |
| 1083 | + | |
| 1084 | + | ```text |
| 1085 | + | sts.us-east-1.amazonaws.com | deploy.yml | production |
| 1086 | + | s3.us-east-1.amazonaws.com | deploy.yml | production |
| 1087 | + | sts.googleapis.com | deploy.yml | production |
| 1088 | + | iamcredentials.googleapis.com | deploy.yml | production |
| 1089 | + | login.microsoftonline.com | deploy.yml | production |
| 1090 | + | management.azure.com | deploy.yml | production |
| 1091 | + | ``` |
| 1092 | + | |
| 1093 | + | | Cloud | Token exchange | Then | |
| 1094 | + | | --- | --- | --- | |
| 1095 | + | | AWS | `sts.<region>.amazonaws.com`, the region `aws-region` names | Each service the job uses, such as `s3.<region>.amazonaws.com`, or `*.amazonaws.com` for all of them | |
| 1096 | + | | Google Cloud | `sts.googleapis.com`, `iamcredentials.googleapis.com` | Each API the job uses, such as `run.googleapis.com` | |
| 1097 | + | | Azure | `login.microsoftonline.com` | `management.azure.com`, and each service the job uses | |
| 1098 | + | |
| 1099 | + | Without them, the login step fails with `403` and a line naming the host |
| 1100 | + | that is not allowed. |
| 1101 | + | |
| 1071 | 1102 | | ### Claims |
| 1072 | 1103 | | |
| 1073 | 1104 | | Each token carries the claims GitHub's do, so trust policies written for |
| ⋯ |
| 1121 | 1152 | | } |
| 1122 | 1153 | | ``` |
| 1123 | 1154 | | |
| 1124 | | − | 3. Use `aws-actions/configure-aws-credentials@v4` with `role-to-assume`, |
| 1155 | + | 3. Allow `sts.<region>.amazonaws.com`, and what the job deploys to, as |
| 1156 | + | [workflow-only domains](#reaching-your-cloud). |
| 1157 | + | 4. Use `aws-actions/configure-aws-credentials@v4` with `role-to-assume`, |
| 1125 | 1158 | | as above. |
| 1126 | 1159 | | |
| 1127 | 1160 | | ### Google Cloud |
| ⋯ |
| 1145 | 1178 | | --member="principalSet://iam.googleapis.com/projects/123456789/locations/global/workloadIdentityPools/g1t/attribute.repository/acme/web" |
| 1146 | 1179 | | ``` |
| 1147 | 1180 | | |
| 1148 | | − | 3. Use `google-github-actions/auth@v2` with |
| 1181 | + | 3. Allow `sts.googleapis.com` and `iamcredentials.googleapis.com`, and |
| 1182 | + | the APIs the job uses, as [workflow-only domains](#reaching-your-cloud). |
| 1183 | + | 4. Use `google-github-actions/auth@v2` with |
| 1149 | 1184 | | `workload_identity_provider: projects/123456789/locations/global/workloadIdentityPools/g1t/providers/g1t` |
| 1150 | 1185 | | and `service_account`. It asks for the provider's own name as the |
| 1151 | 1186 | | audience, which the provider accepts unless you change its allowed |
| ⋯ |
| 1169 | 1204 | | ``` |
| 1170 | 1205 | | |
| 1171 | 1206 | | 2. Give it a role on what it deploys to, as for any identity. |
| 1172 | | − | 3. Use `azure/login@v2` with `client-id`, `tenant-id` and |
| 1207 | + | 3. Allow `login.microsoftonline.com` and `management.azure.com` as |
| 1208 | + | [workflow-only domains](#reaching-your-cloud). |
| 1209 | + | 4. Use `azure/login@v2` with `client-id`, `tenant-id` and |
| 1173 | 1210 | | `subscription-id`, and no secret. |
| 1174 | 1211 | | |
| 1175 | 1212 | | A federated credential matches the subject exactly: add one per |
| ⋯ |
| 1681 | 1718 | | [Secrets and variables](/guides/secrets-and-variables/) for how rows, |
| 1682 | 1719 | | environments and the workspace's rows work. |
| 1683 | 1720 | | |
| 1721 | + | To deploy to AWS, Google Cloud or Azure, or to a server of your own, |
| 1722 | + | you need no secret at all: give the job `permissions: id-token: write` |
| 1723 | + | and trade its [OIDC token](#oidc-tokens) for short-lived credentials. |
| 1724 | + | |
| 1684 | 1725 | | Every job also gets `${{ secrets.G1T_TOKEN }}`, [its own token](#the-jobs-token), |
| 1685 | 1726 | | with `GITHUB_TOKEN` as its alias. A pull request's runs get secrets only |
| 1686 | 1727 | | when its author has the Write [role](/guides/access-and-roles/) or higher |