I am trying to connect jenkins from azure Devops pipeline and is it mandatory to set the jenkins url with public Ip?
I am not familiar with using Azure DevOps Pipeline but I assume that it is a service that you want to allow to connect to the Jenkins controller. The Jenkins controller will need to be reachable from the Azure DevOps service. That either means the controller needs to be within the same network as the Azure DevOps service or a public address is needed.
With webhooks, people often use public services that allow webhooks from the public internet to reach their private network. Some examples are available in videos
There are also blog posts that describe the technique, including