Skip to content

Commit 2b74eee

Browse files
ianwallenCopilot
andauthored
Add extra validation based on review.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 1d97276 commit 2b74eee

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

docs/pipelines/agents/docker.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,16 @@ Next, create the Dockerfile.
319319
# Load a token either from the environment variable or by using the service principal credentials.
320320
load_azp_token() {
321321
if [ -n "$AZP_CLIENTID" ]; then
322+
if [ -z "$AZP_CLIENTSECRET" ]; then
323+
echo 1>&2 "error: AZP_CLIENTSECRET must be set when AZP_CLIENTID is used"
324+
exit 1
325+
fi
326+
327+
if [ -z "$AZP_TENANTID" ]; then
328+
echo 1>&2 "error: AZP_TENANTID must be set when AZP_CLIENTID is used"
329+
exit 1
330+
fi
331+
322332
echo "Using service principal credentials to get token"
323333
az login --allow-no-subscriptions --service-principal --username "$AZP_CLIENTID" --password "$AZP_CLIENTSECRET" --tenant "$AZP_TENANTID"
324334
# adapted from https://learn.microsoft.com/en-us/azure/databricks/dev-tools/user-aad-token

0 commit comments

Comments
 (0)