Any outdoor woodwork should be viewed as expendable, because it will eventually rot.
Timber posts buried in the ground, or standing on a wert surface, will rot fastest.
If you want a long-lived base, you could plant concrete spurs in concrete, and bolt your legs to them above ground level. You probably only need the 4-foot ones, they are not very expensive, and by having them on the inner face of the posts they will be out of sight.
The same method can be used for the posts of a shed or carport.
Edit
you can also use the method of casting concrete pads into the ground, with the cast-in or bolt-down steel support sockets for your posts. In this case the bottom of the post is near the ground so will get wet from rainsplash, so you should soak it in preservative and preferably set it inside the footprint of your shed. I've used the bolt-down ones (with stainless bolts) so I can remove them and leave a flat surface to drive over if/when I remove the carport. Use wooden formwork round the top of the pad so it looks small and neat at ground level. The sockets will take vertical loads, but don't resist much sideways, so wind will make a fence lean. Paint the steel thoroughly as it will rust.