I tried to run the dotnet tool installed in Azure DevOps and test the tool.
Locally
dotnet tool install dotnetsay -g
dotnetsay test
It works seamlessly without any problem.
When I run this script in Azure DevOps.
  - task: CmdLine@2
    displayName: 'Install dotnetsay'
    inputs:
      script: 'dotnet tool install dotnetsay -g'
  - task: CmdLine@2
    displayName: 'Run dotnetsay'
    inputs:
      script: 'dotnetsay test'
It returns this error.
/home/vsts/work/_temp/8a35f36d-4eff-4541-9aae-cf3f063f9180.sh: line 1: dotnetsay: command not found
##[error]Bash exited with code '127'.
I've tried 3 different tools:
all of them gave the same result 
Is there any additional command to make the dotnet tool available for Azure DevOps?