Oracle Functions and .NET - Getting Started Part 3
In Part 1 of this blog post, we set up your OCI account to be ready to deploy functions.
In Part 2 of this blog post, we set up your development environment to be ready to deploy functions.
In Part 3, we will dive into the main content to build and publish our first .NET OCI function. As I mentioned at the end of party 2, most of this work has been in getting prepaired to develop functions. You don’t have to go through hours of setup every time you want to create a new function!
Logging into docker
In order to progress with publishing functions you will need to log into docker so that you can push your functions to the repository. Use the following command:
docker login -u '<<tenancy-namespace>>/<<user-name>>' ocir.<<regionkey>>.oci.oraclecloud.com
The Tenancy Namespace is a value we recorded earlier. The username will be your email address to log into your OCI account. As I mentioned in Part 2 of the blog, I am assuming at this point that you are either the root user set up with your OCI account creation or a member of the Administrators group.
When the docker prompt asks you for the password, provide the Auth key that was created earlier, NOT your OCI login password.

Once logged in, your password will be saved. Make sure to keep your system secure!
Creating a new function
From the command line, navigate to a location where you are going to store your source code. Use the following command to create a new function.
fn init --runtime dotnet hello-world

This will create a boilerplate OCI function called “hello-world” using the .NET runtime… of course! The command line will set up a few configuration files, as well as the .NET project that will be used to build your function’s executable. As I am writing this, Oracle functions support running .NET only on X86 architecture, not ARM.
Deploy your function to OCI.
Type the following commands to deploy your function:
cd hello-world
fn -v deploy --app <<Your Application Name>>
The application name is the name of the application you created in Part 1 of the blog post.
Note: If you run into issues with the deployment reporting that you are unauthorized, double-check your login command. It took me some digging to ensure I had it correct. My login command looks like this for US-East(Ashburn):
docker login -u '<<Namespace>>/<<Email@address>>' ocir.us-ashburn-1.oci.oraclecloud.com
Invoking your function
Once your function has been deployed, you will want to test the function to ensure that all is well. Luckily, the Fn command line makes this pretty easy.
fn invoke <<Your Application Name>> <<Your Function Name>>

Your function in the OCI console
In the OCI console, you can select the hamburger menu and then select Developer Services and Applications under functions Functions.

Click on your application.

Scroll down, and you can see the individual functions that are part of your application.

From here, you are ready to start building new functions to solve many business problems!

