Azure ML Execute R Script component - security error

Bill Ehrreich 0 Reputation points
2025-08-09T15:47:18.52+00:00

For purposes of testing R functionality with Azure ML, I have created a simple pipeline with an Execute R Script step. No matter what script I put in the step, when the job runs, it ends in an error. The error is shown below in pink at right: "The code of this job is not protected by our systems and not secure...". What do I need to do to get around this error so that I can use the Execute R Script step?

User's image

Azure Machine Learning
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 22,576 Reputation points Volunteer Moderator
    2025-08-11T08:30:03.9266667+00:00

    Hello Bill Ehrreich,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that your Azure ML Execute R Script component is having security error.

    The error is because you're using the inline R script or unvalidated script bundle which does not meet Azure ML’s security validation requirements. Inline scripts are not validated for security, so avoid it and always use script bundles for:

    • Production pipelines
    • Sensitive data processing
    • External package usage

    Therefore,

    1. Use Script Bundle Instead of Inline Code by:
      • Creating a .zip file containing your R script (e.g., my_script.R),
      • Upload it as a File Dataset in Azure ML Studio,
      • Connect it to the Script Bundle input port of the Execute R Script component.
      In the link you will see how you can execute R Script Component - https://learn.microsoft.com/en-us/azure/machine-learning/component-reference/execute-r-script?view=azureml-api-2
    2. Always use proper entry point in your script, it must define:
         azureml_main <- function(dataframe1, dataframe2){
           source("./Script Bundle/my_script.R")
           result <- my_func(dataframe1)
           return(list(dataset1=result, dataset2=dataframe2))
         }
      
      In this link you will find AzureML-R-template on GitHub - https://github.com/microsoft/AzureML-R-template
    3. Use CLI or YAML for an advanced R workloads and if designer fails, switch to CLI-based workflows:

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.