@Shivapriya Katta The command az ml folder attach will create the directories and add the config file to .azureml to ensure the workspace resources are easily accessible. You can lookup the note section of the command for reference.
This command creates a .azureml subdirectory that contains example runconfig and conda environment files. It also contains a config.json file that is used to communicate with your Azure Machine Learning workspace.
The authentication error in your case could be because
az login command might have been missed which allows the cli to authenticate interactively or service principal or MI and then run rest of the commands. You can try to run this and check if the attach works successfully.
Also, with the devops pipeline I am not sure if
az devops login is required to be run but if the above command fails even after
az login authentication you can try az devops login.
If an answer is helpful, please click on or upvote which might help other community members reading this thread.