{"id":18084170,"url":"https://github.com/bpcjr01/azure2snipe","last_synced_at":"2026-05-14T20:33:30.737Z","repository":{"id":259308795,"uuid":"877546269","full_name":"bpcjr01/azure2snipe","owner":"bpcjr01","description":"A Python Script that imports devices from an Azure tenant to Snipe-IT, made entirely with Chat-GPT.","archived":false,"fork":false,"pushed_at":"2025-08-23T00:55:37.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-01T14:44:17.619Z","etag":null,"topics":["azure","azuread","integration","intune","microsoft","microsoft-azure","microsoft-intune","python","snipe-it"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bpcjr01.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-23T20:50:46.000Z","updated_at":"2025-08-23T00:55:41.000Z","dependencies_parsed_at":"2024-10-24T11:12:29.906Z","dependency_job_id":null,"html_url":"https://github.com/bpcjr01/azure2snipe","commit_stats":null,"previous_names":["bpcjr01/azure2snipe"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bpcjr01/azure2snipe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcjr01%2Fazure2snipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcjr01%2Fazure2snipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcjr01%2Fazure2snipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcjr01%2Fazure2snipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpcjr01","download_url":"https://codeload.github.com/bpcjr01/azure2snipe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcjr01%2Fazure2snipe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33042224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azuread","integration","intune","microsoft","microsoft-azure","microsoft-intune","python","snipe-it"],"created_at":"2024-10-31T15:05:55.301Z","updated_at":"2026-05-14T20:33:30.721Z","avatar_url":"https://github.com/bpcjr01.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Version 2.0.0\r\n# Snipe-IT and Azure AD Sync Script\r\n\r\n\r\nThis repository contains a forked and extended version (v2.0.0) of the original `azure2snipe` sync script.\r\n\r\n\r\n\u003e This file is an update to the original README (original was v1.0.0). See the changelog and PR for full details.\r\n\r\n---\r\n\r\n## Features\r\n\r\n- Import devices from Azure AD or InTune.\r\n- Automatically create or update devices in Snipe-IT.\r\n- Assign devices to users as per Azure data.\r\n- Handle missing models and categories by creating them in Snipe-IT.\r\n- Supports \"dry-run\" mode for testing without making changes.\r\n- Verbose mode for detailed logging.\r\n- Configurable SSL verification and TLS warning suppression.\r\n- Option to slow down requests to avoid rate-limiting.\r\n\r\n\r\n## What changed in v2.0.0 \r\n\r\n- **Asset tag equals Serial on import**: the script sets the `asset_tag` to the device `serialNumber` when creating new assets to avoid Snipe-IT validation errors.\r\n- **Smart update logic**: when a device already exists in Snipe-IT (matched by serial), the script will **not** overwrite `asset_tag` or `serial`. It updates only:\r\n  - `name` (device name),\r\n  - `assigned_user` (owner),\r\n  - `status_id` (device status) — only when appropriate.\r\n- **Improved owner assignment**:\r\n  - Flexible user lookup: tries `UPN`, `email`, derived username (from UPN), display name contains and last-resort userId.\r\n  - If a device gains an owner, the script creates a **checkout** in Snipe-IT (for traceability).\r\n- **Status handling based on compliance and ownership**:\r\n  - `noncompliant` (Intune) → `Pending` in Snipe-IT.\r\n  - `compliant` + **no owner** → `Ready to Deploy`.\r\n  - `compliant` + **has owner** → `Ready to Deploy` and checkout to assigned user\r\n- **Idempotency \u0026 safety**: re-running the script e.g daily will generally only change device name, owner or status on real changes; it preserves manual edits of `asset_tag` and `serial`.\r\n- **Robust API handling**: tolerates different shapes of Snipe-IT API responses (int id, list, dict with `rows` or `payload`) and avoids crashes\r\n- **Improved logging**: verbose mode (`-v`) shows normalization decisions and reasoned actions for easier troubleshooting.\r\n\r\n(For more details about v2.0.0, check out the detailed changelog in CHANGELOG.md)\r\n\r\n\r\n## Prerequisites\r\n\r\n- Python 3.8+\r\n- MSAL Python Library for Azure AD authentication. (pip install msal)\r\n- Snipe-IT API token with permissions to manage hardware, models, and categories.\r\n- Azure App registration with `DeviceManagementManagedDevices.Read.All` and `User.Read.All`\r\n\r\n\r\n## Configuration\r\n\r\nA template file should come with a copy of this script. Please remove \".template\" from \"azure2snipe.cfg\" and add information as needed. Please see \"APPREGGUIDE\" for Azure config help.\r\n\r\n\r\n## Usage\r\n\r\nRun the script using the command line:\r\n\r\n```sh\r\npython azure2snipe [OPTIONS]\r\n```\r\n\r\n\r\n### Options\r\n\r\n- `--dry-run` : Perform a dry run without making any changes to Snipe-IT.\r\n- `-v`, `--verbose` : Enable verbose output for detailed logging.\r\n- `--do-not-verify-ssl` : Disable SSL verification for Snipe-IT requests.\r\n- `--slowdown` : Add a 1-second delay to each request to avoid rate-limiting.\r\n- `--suppress-tls-warning` : Suppress TLS warnings.\r\n\r\n\r\n### Examples\r\n\r\n1. **Perform a dry run without making changes**\r\n   ```sh\r\n   python azure2snipe --dry-run\r\n   ```\r\n\r\n2. **Run the sync with verbose output**\r\n   ```sh\r\n   python azure2snipe -v\r\n   ```\r\n\r\n3. **Disable SSL verification for Snipe-IT requests**\r\n   ```sh\r\n   python azure2snipe --do-not-verify-ssl\r\n   ```\r\n\r\n4. **Run with a delay between requests to avoid rate-limiting**\r\n   ```sh\r\n   python azure2snipe --slowdown\r\n   ```\r\n\r\n\r\n## Error Handling\r\n\r\nThe script includes enhanced error handling for common issues:\r\n- If a category or model is missing in Snipe-IT, it will attempt to create it.\r\n- If SSL verification is disabled, warnings are suppressed if the `--suppress-tls-warning` option is used.\r\n- Detailed error messages are provided for failed API calls.\r\n\r\n## Troubleshooting\r\n\r\n-If an asset is created with unexpected status, check:\r\n -Intune complianceState.\r\n -Whether Snipe-IT contains labels named exactly Deployed / Ready to Deploy / Pending.\r\n-Use -v for detailed logs (shows the exact decisions and matched user IDs).\r\n-If user matching fails, verify that Snipe-IT users have either username or email that matches Azure UPN or display name.\r\n\r\n\r\n## Recommended workflow (for production)\r\n\r\n-Run the script as a scheduled job (daily) so owner and name changes propagate automatically.\r\n-Keep asset_tag and serial stable in Snipe-IT (the script will not overwrite them).\r\n-Use --dry-run when testing new changes.\r\n\r\n\r\n## Changelog \u0026 Release Notes\r\n\r\nPlease see CHANGELOG.md or the PR body for full details of v2.0.0 changes and rationale.\r\n\r\n\r\n## Contributing\r\n\r\nFeel free to fork this project and submit pull requests. Contributions are always welcome to make the script more robust and feature-rich for the community.\r\n\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\n## Acknowledgements\r\n\r\nThis fork was developed collaboratively (original project by bpcjr01; improvements implemented by karOS555).\r\nThis script was developed with the assistance of ChatGPT, an AI language model by OpenAI. Special thanks to the Snipe-IT and Azure communities for their documentation and tools.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpcjr01%2Fazure2snipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpcjr01%2Fazure2snipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpcjr01%2Fazure2snipe/lists"}