Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure Batch Python SDK] Property authenticationTokenSettings is not enabled for current account #39398

Open
tmatup opened this issue Jan 25, 2025 · 1 comment
Labels
Batch customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@tmatup
Copy link

tmatup commented Jan 25, 2025

We are now getting Property authenticationTokenSettings is not enabled for current account error when our code (using Azure Batch Python SDK) is trying to add a new job schedule to our Azure Batch Account service instance. Our deployment pipeline already set the authentication mode for the batch account to have TaskAuthenticationToken enabled. And the azure batch client instance (in the code) were created using an managed identity which was already has Contributor role assigned for accessing the same batch account. Everything was working earlier until now and we didn't have code changes related to authentication for a while. What could go run?

pip show azure-batch
Name: azure-batch
Version: 14.2.0

Please see below for the code, the exception were thru on the line doing batch_service_client.job_schedule.add

        container_settings = models.TaskContainerSettings(image_name=container_image)
        job_manager_task = models.JobManagerTask(
            id=f"job_manager_task_{job_id}",
            command_line=command_line,
            container_settings=container_settings,
            environment_settings=[models.EnvironmentSetting(name=k, value=v) for k, v in environment_settings.items()],
            constraints=models.TaskConstraints(max_task_retry_count=0),
            user_identity=models.UserIdentity(
                auto_user=models.AutoUserSpecification(scope=models.AutoUserScope.task, elevation_level=models.ElevationLevel.non_admin)
            ),
            authentication_token_settings=models.AuthenticationTokenSettings(access=[models.AccessScope.job]),
            kill_job_on_completion=False,
            run_exclusive=False,
        )
        job_specification = models.JobSpecification(
            job_manager_task=job_manager_task,
            constraints=models.JobConstraints(max_task_retry_count=0),
            pool_info=models.PoolInformation(pool_id=pool_id),
            priority=job_priority,
            on_all_tasks_complete=models.OnAllTasksComplete.terminate_job,
        )
        job_schedule_id = f"job_schedule_{job_id}"
        batch_service_client = await self._get_batch_service_client(self._batch_url)
        try:
            if batch_service_client.job_schedule.exists(job_schedule_id):
                if recurring:
                    job_schedule_update_parameter = models.JobScheduleUpdateParameter(
                        schedule=models.Schedule(**job_schedule), job_specification=job_specification
                    )
                    batch_service_client.job_schedule.update(job_schedule_id=job_schedule_id, job_schedule_update_parameter=job_schedule_update_parameter)
                    self._logger.info(f"Job {job_id} schedule updated on pool {pool_id}")
                else:
                    # nothing to do for non-recurring jobs
                    pass
            else:
                job_schedule_add_parameter = models.JobScheduleAddParameter(
                    id=job_schedule_id, schedule=models.Schedule(**job_schedule), job_specification=job_specification
                )
                batch_service_client.job_schedule.add(cloud_job_schedule=job_schedule_add_parameter)
                self._logger.info(f"Job {job_id} schedule added on pool {pool_id}")
        except BatchErrorException as e:
            raise Exception(f"{e.message}") from e
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 25, 2025
@xiangyan99 xiangyan99 added Batch Service Attention Workflow: This issue is responsible by Azure service team. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Jan 27, 2025
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jan 27, 2025
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cRui861 @dpwatrous @jingjlii @JJJessieWang @wanghoppe @wiboris.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Batch customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants