I have resolved this issue by following the below commands.
dotnet publish EDI_Portalwebapi.csproj /p:PublishProfile="Profile_name" /p:Password=<App-service_password>
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-8.0#:~:text=PublishProfile%3D%3CFolderProfileName%3E-,MSDeploy%3A,-.NET%20CLI