the code is 100% working, i just tested it out with my endpoint see below
the 3 things could lead to 404 error are below. make sure you find them explicitly in azure's endpoint page. (see last screenshot)