Big tech companies such as Amazon and Microsoft are getting more H-1B visas for foreign workers, and outsourcing firms are getting fewer.

Amazon was the second largest recipient of new H-1B visas in 2017, according to an analysis released on Thursday by the National Foundation for American Policy.

The e-commerce giant was awarded 2,515 new visas for workers -- up from 1,416 in 2016.

H-1B visas are the popular yet controversial work visa used to help fill a skills gap in the US by bringing in foreign workers.

Only 85,000 H-1B visas are granted annually. When demand for the visa exceeds the supply, a lottery system is activated.

Earlier this month, the US Citizenship and Immigration Services said the H-1B visa application cap was once again met within a five day period, marking the sixth consecutive year.

Ahead of Amazon, Cognizant -- a New Jersey-based IT services company -- had the most approved H-1B visas in 2017. But its total number of applications declined 25% from the year before.

Major tech companies like Microsoft, Intel, Google, Apple and Facebook were among the top 15 employers approved for initial H-1B visas last year, NFAP revealed.

Critics -- including the administration of President Trump -- say outsourcing firms abuse the H-1B visa's lottery system and flood it so they can later contract them out to tech companies.

Related: H-1B visa applications are down again

"The top recipients of the H-1B visa are companies like Tata, Infosys [and] Cognizant," a senior White House official said in April 2017. "They will apply for a very large number of visas ... by putting extra tickets in the lottery raffle, if you will, and then they'll get the lion's share of visas."

But this year marked a decline in applications by outsourcing firms, according to the report.

Indian outsourcing firm Tata Consultancy Services has previously said it applied for far fewer visas this year as it focused on hiring American workers as consultants. According to NFAP's report, it received only 2,312 visas this year -- less than half of the number it secured two years ago. Infosys and Wipro also experienced drops.