if you have some C# code which you would like to run as Azure function then first of all create new Azure function project in Visual Studio (you may create Azure functions also without VS but it is much simpler with it):
Then add new Azure function there with needed trigger - depending on your requirements, e.g. http trigger when function is triggered by http request:
Add you C# code there and then publish it to Azure portal > Function app from Visual Studio (right click on the project > Publish):
After that your code will run as Azure function in Azure portal.