[{"data":1,"prerenderedAt":408},["ShallowReactive",2],{"navigation":3,"\u002Fsync-api\u002Fexamples":99,"\u002Fsync-api\u002Fexamples-surround":407},[4,16,52,71,91],{"title":5,"path":6,"stem":7,"children":8,"icon":15},"Getting Started","\u002Fgetting-started","1.getting-started\u002F1.index",[9,11],{"title":10,"path":6,"stem":7},"Introduction",{"title":12,"path":13,"stem":14},"Authentication","\u002Fgetting-started\u002Fauthentication","1.getting-started\u002F2.authentication","i-tabler-rocket",{"title":17,"path":18,"stem":19,"children":20,"icon":51},"GraphQL API","\u002Fgraphql-api","2.graphql-api\u002F1.index",[21,23,27,31,35,39,43,47],{"title":22,"path":18,"stem":19},"API Overview",{"title":24,"path":25,"stem":26},"Querying Patterns","\u002Fgraphql-api\u002Fquerying","2.graphql-api\u002F2.querying",{"title":28,"path":29,"stem":30},"Mutation Patterns","\u002Fgraphql-api\u002Fmutations","2.graphql-api\u002F3.mutations",{"title":32,"path":33,"stem":34},"List SaaS Applications","\u002Fgraphql-api\u002Fguides\u002Flist-applications","2.graphql-api\u002F4.guides\u002F1.list-applications",{"title":36,"path":37,"stem":38},"Find Unused Licenses","\u002Fgraphql-api\u002Fguides\u002Ffind-unused-licenses","2.graphql-api\u002F4.guides\u002F2.find-unused-licenses",{"title":40,"path":41,"stem":42},"Retrieve Upcoming Renewals","\u002Fgraphql-api\u002Fguides\u002Fupcoming-renewals","2.graphql-api\u002F4.guides\u002F3.upcoming-renewals",{"title":44,"path":45,"stem":46},"Handle GraphQL Errors","\u002Fgraphql-api\u002Fguides\u002Fhandle-errors","2.graphql-api\u002F4.guides\u002F4.handle-errors",{"title":48,"path":49,"icon":50},"API Reference","\u002Fgql-schema-reference","i-tabler-file-code","i-tabler-braces",{"title":53,"path":54,"stem":55,"children":56,"icon":70},"Sync API","\u002Fsync-api","3.sync-api\u002F1.index",[57,59,63,67],{"title":58,"path":54,"stem":55},"Viio Sync API",{"title":60,"path":61,"stem":62},"Quickstart","\u002Fsync-api\u002Fquickstart","3.sync-api\u002F2.quickstart",{"title":64,"path":65,"icon":66},"Examples","\u002Fsync-api\u002Fexamples","i-tabler-code",{"title":68,"path":69,"icon":50},"SDK Reference","\u002Fsync-api\u002Fapi-reference","i-tabler-refresh",{"title":72,"path":73,"stem":74,"children":75,"icon":90},"MCP Server","\u002Fmcp-server","4.mcp-server\u002F1.index",[76,78,82,86],{"title":77,"path":73,"stem":74},"Viio MCP Server",{"title":79,"path":80,"stem":81},"Setup","\u002Fmcp-server\u002Fsetup","4.mcp-server\u002F2.setup",{"title":83,"path":84,"stem":85},"Available Tools","\u002Fmcp-server\u002Ftools","4.mcp-server\u002F3.tools",{"title":87,"path":88,"stem":89},"SaaS Analysis Use Cases","\u002Fmcp-server\u002Fuse-cases","4.mcp-server\u002F4.use-cases","i-tabler-robot",{"title":92,"path":93,"stem":94,"children":95,"icon":98},"AI Integration","\u002Fai","5.ai\u002F1.index",[96],{"title":97,"path":93,"stem":94},"llms.txt","i-tabler-sparkles",{"id":100,"title":64,"body":101,"dateModified":395,"datePublished":396,"description":397,"extension":398,"links":399,"meta":400,"navigation":401,"path":65,"seo":402,"stem":405,"__hash__":406},"docs\u002F3.sync-api\u002F6.examples\u002F1.index.md",{"type":102,"value":103,"toc":390},"minimark",[104,114,142,147,150,171,174,212,215,299,302,306,309,368,379,382,386],[105,106,107,108,113],"p",{},"These examples use the ",[109,110,112],"a",{"href":111},"\u002Fsync-api\u002Fapi-reference\u002Fpython","Viio Python SDK"," to send Microsoft data to Viio. Each script reads Microsoft Graph with a Microsoft Entra application and sends a complete snapshot in one batch. You can run the scripts from your workstation, any scheduler, or AWS Lambda.",[115,116,117,126,134],"card-group",{},[118,119,123],"card",{"icon":120,"title":121,"to":122},"i-tabler-users","Microsoft Entra ID","\u002Fsync-api\u002Fexamples\u002Fmicrosoft-entra-id-python",[105,124,125],{},"Send Entra ID users as a complete employee snapshot.",[118,127,131],{"icon":128,"title":129,"to":130},"i-tabler-license","Microsoft Licenses","\u002Fsync-api\u002Fexamples\u002Fmicrosoft-licenses-python",[105,132,133],{},"Send Microsoft 365 plans with their service plans and subscriptions, the accounts and licenses assigned to them, and each user's app usage.",[118,135,139],{"icon":136,"title":137,"to":138},"i-tabler-cloud-cog","AWS Lambda","\u002Fsync-api\u002Fexamples\u002Faws-lambda-python",[105,140,141],{},"Run both syncs on a schedule from AWS Lambda.",[143,144,146],"h2",{"id":145},"shared-setup","Shared Setup",[105,148,149],{},"You need:",[151,152,153,157,160,168],"ul",{},[154,155,156],"li",{},"Python 3.11 or later.",[154,158,159],{},"A passive direct integration installation and its ID.",[154,161,162,163,167],{},"A Viio API key with the ",[164,165,166],"code",{},"integration:sync"," permission.",[154,169,170],{},"A Microsoft Entra application with a client secret. Grant it the Microsoft Graph application permissions that each example lists, with tenant-wide admin consent.",[105,172,173],{},"Install the SDK:",[175,176,181],"pre",{"className":177,"code":178,"language":179,"meta":180,"style":180},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","python -m pip install \"viio-sync-api-sdk>=0.5.0\"\n","bash","",[164,182,183],{"__ignoreMap":180},[184,185,188,192,196,199,202,206,209],"span",{"class":186,"line":187},"line",1,[184,189,191],{"class":190},"sBMFI","python",[184,193,195],{"class":194},"sfazB"," -m",[184,197,198],{"class":194}," pip",[184,200,201],{"class":194}," install",[184,203,205],{"class":204},"sMK4o"," \"",[184,207,208],{"class":194},"viio-sync-api-sdk>=0.5.0",[184,210,211],{"class":204},"\"\n",[105,213,214],{},"Both scripts read the same environment variables:",[216,217,218,231],"table",{},[219,220,221],"thead",{},[222,223,224,228],"tr",{},[225,226,227],"th",{},"Variable",[225,229,230],{},"Description",[232,233,234,245,255,265,277,289],"tbody",{},[222,235,236,242],{},[237,238,239],"td",{},[164,240,241],{},"MICROSOFT_TENANT_ID",[237,243,244],{},"Microsoft Entra tenant ID or verified domain",[222,246,247,252],{},[237,248,249],{},[164,250,251],{},"MICROSOFT_CLIENT_ID",[237,253,254],{},"Entra application client ID",[222,256,257,262],{},[237,258,259],{},[164,260,261],{},"MICROSOFT_CLIENT_SECRET",[237,263,264],{},"Entra application client secret",[222,266,267,272],{},[237,268,269],{},[164,270,271],{},"VIIO_SYNC_API_ENDPOINT",[237,273,274],{},[164,275,276],{},"https:\u002F\u002Fsync.viio.io",[222,278,279,284],{},[237,280,281],{},[164,282,283],{},"VIIO_SYNC_API_KEY",[237,285,286,287],{},"Viio API key with ",[164,288,166],{},[222,290,291,296],{},[237,292,293],{},[164,294,295],{},"VIIO_DIRECT_INTEGRATION_INSTALLATION_ID",[237,297,298],{},"Installation that receives the data",[105,300,301],{},"Supply secret values through your secret-management system. Do not commit them to source control.",[143,303,305],{"id":304},"script-structure","Script Structure",[105,307,308],{},"Each script has the same three entry points:",[216,310,311,321],{},[219,312,313],{},[222,314,315,318],{},[225,316,317],{},"Function",[225,319,320],{},"Purpose",[232,322,323,340,354],{},[222,324,325,330],{},[237,326,327],{},[164,328,329],{},"sync_*(write)",[237,331,332,333,336,337],{},"Reads Microsoft Graph and passes every ",[164,334,335],{},"SyncRecordsRequest"," to ",[164,338,339],{},"write",[222,341,342,347],{},[237,343,344],{},[164,345,346],{},"run_batch(sync)",[237,348,349,350,353],{},"Starts a batch, runs the sync function with ",[164,351,352],{},"batch.write",", and completes the batch, or aborts it if anything fails",[222,355,356,361],{},[237,357,358],{},[164,359,360],{},"main()",[237,362,363,364,367],{},"Command-line entry point; ",[164,365,366],{},"--dry-run"," prints the requests as JSON instead of sending them",[105,369,370,371,374,375,378],{},"The ",[109,372,373],{"href":138},"AWS Lambda example"," imports ",[164,376,377],{},"run_batch"," and the sync functions.",[105,380,381],{},"Only one batch can be active for an installation at a time. If both scripts send to the same installation, schedule them so they don't overlap.",[383,384],"read-more",{"title":385,"to":61},"Learn the batch lifecycle",[387,388,389],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":180,"searchDepth":187,"depth":391,"links":392},2,[393,394],{"id":145,"depth":391,"text":146},{"id":304,"depth":391,"text":305},"2026-10-15","2026-10-06","Python examples that send Microsoft Entra ID employees and Microsoft 365 licenses and usage to Viio and run them on AWS Lambda.","md",null,{},false,{"title":403,"description":404},"Viio Sync API Python Examples","Python examples that sync Microsoft Entra ID employees and Microsoft 365 plans, accounts, licenses, and usage to Viio, and host the syncs on AWS Lambda.","3.sync-api\u002F6.examples\u002F1.index","suMsDZ9jpf29-gyL0E-TSiZhq0m4IIHB7-KQfcw_0t4",[399,399],1792747809403]