{"id":19297485,"url":"https://github.com/rakheshster/docker-powershell-msgraph","last_synced_at":"2025-02-24T01:11:51.501Z","repository":{"id":212292564,"uuid":"731133157","full_name":"rakheshster/docker-powershell-msgraph","owner":"rakheshster","description":"Docker container with MS Graph PowerShell module","archived":false,"fork":false,"pushed_at":"2024-08-09T09:12:48.000Z","size":59,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-16T13:05:03.838Z","etag":null,"topics":["docker","docker-container","msgraph","powershell"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rakheshster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-12-13T12:31:27.000Z","updated_at":"2024-08-09T09:12:51.000Z","dependencies_parsed_at":"2023-12-19T03:20:44.325Z","dependency_job_id":"c7aee5d9-5a18-4459-b4a2-a02c85c0bb91","html_url":"https://github.com/rakheshster/docker-powershell-msgraph","commit_stats":null,"previous_names":["rakheshster/docker-powershell-msgraph"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheshster%2Fdocker-powershell-msgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheshster%2Fdocker-powershell-msgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheshster%2Fdocker-powershell-msgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakheshster%2Fdocker-powershell-msgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rakheshster","download_url":"https://codeload.github.com/rakheshster/docker-powershell-msgraph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240400338,"owners_count":19795332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker","docker-container","msgraph","powershell"],"created_at":"2024-11-09T23:05:05.714Z","updated_at":"2025-02-24T01:11:51.465Z","avatar_url":"https://github.com/rakheshster.png","language":"PowerShell","readme":"# docker-powershell-msgraph\nDocker container with specific MS Graph PowerShell versions. \n\n[![Build \u0026 Push (if any updates)](https://github.com/rakheshster/docker-powershell-msgraph/actions/workflows/docker-build-and-push-cron.yaml/badge.svg)](https://github.com/rakheshster/docker-powershell-msgraph/actions/workflows/docker-build-and-push-cron.yaml)\n\n## Why?\nCoz when I am troubleshooting why a specific cmdlet isn't working I'd like to easily switch to different version of the cmdlets instead of uninstalling/ reinstalling etc. \n\n## Building \u0026 Running this locally\nHere's what I do:\n\nFor the latest version:\n\n```\ndocker build --progress=plain --no-cache . --network host -t graph-latest\n\ndocker run -it --network host --rm \\\n    -v /path/to/Scripts:/root/Scripts:ro \\\n    -v /path/to/MoreScripts:/root/MoreScripts:ro \\\n    -v /HOME/.config/powershell:/root/.config/powershell:ro \\\n    graph-latest\n```\n\nFor a specific version (2.10.0 in this case):\n\n```\nversion=\"2.10.0\"\ndocker build --progress=plain --no-cache . --network host --build-arg=\"GRAPH_VERSION=$version\" -t graph-$version\n\ndocker run -it --network host --rm \\\n    -v /path/to/Scripts:/root/Scripts:ro \\\n    -v /path/to/MoreScripts:/root/MoreScripts:ro \\\n    -v /HOME/.config/powershell:/root/.config/powershell:ro \\\n    graph-$version\n```\n\nAlso see the Notes section below.\n\n## Running from Image\nIf you just want to run the Docker image, assuming a version you want is already published under [packages](https://github.com/rakheshster/docker-powershell-msgraph/pkgs/container/docker-powershell-msgraph):\n\n```\nversion=\"2.10.0\"\ndocker pull ghcr.io/rakheshster/docker-powershell-msgraph:$version\n\ndocker run -it --network host --rm \\\n    -v /path/to/Scripts:/root/Scripts:ro \\\n    -v /path/to/MoreScripts:/root/MoreScripts:ro \\\n    -v /HOME/.config/powershell:/root/.config/powershell:ro \\\n    ghcr.io/rakheshster/powershell-msgraph:$version\n```\n\nIn this case I am pulling version 1.21.0. The version number is that of the Graph module.\n\nAlso see the Notes section below.\n\n## NOTES\nYou may not need the `--network host` switch. I needed it coz of the way I was running Docker. \n\nI use the `-v` switch to mount some of my folders containing scripts + the PowerShell profile into the container. This way everything is in place as expected. They are mounted RO in this case. \n\nThe `docker run` command will put you in a PowerShell prompt from which you can `Connect-MgGraph` and so on. \n\nAlso see [my blog post](https://rakhesh.com/azure/docker-powershell-microsoft-graph/) where I talked about it first.\n\nI have since made a Bash function like this:\n```\nfunction docker-graph() {\n    docker run -it --network host --rm \\\n        -v /path/to/Scripts:/root/Scripts:ro \\\n        -v /path/to/MoreScripts:/root/MoreScripts:ro \\\n        -v /HOME/.config/powershell:/root/.config/powershell:ro \\\n    ghcr.io/rakheshster/powershell-msgraph:$1\n}\n```\n\nThe `--rm` switch tells Docker to remove the container when I exit.\n\nThis way I can do `docker-graph 2.10.0` and it will download and put me in that. If the image doesn't exist it errors:\n```\n$ docker-graph 2.9.0\nUnable to find image 'ghcr.io/rakheshster/powershell-msgraph:2.9.0' locally\ndocker: Error response from daemon: manifest unknown.\nSee 'docker run --help'.\n```\n\n### DockerHub version\nThe image is also available on [DockerHub](https://hub.docker.com/repository/docker/rakheshster/powershell-msgraph/general). Instead of `ghcr.io/rakheshster/powershell-msgraph:xxx` above use `rakheshster/powershell-msgraph:xxx`.\n\n### Multi-arch support\nThe original version of this container used the [Ubuntu Powershell](https://github.com/PowerShell/PowerShell-Docker/blob/master/release/7-4/ubuntu22.04/docker/Dockerfile) image from Microsoft as its base. Now it uses the [CBL Mariner PowerShell](https://github.com/PowerShell/PowerShell-Docker/blob/master/release/7-4/mariner2-arm64/docker/Dockerfile) image as its base. Reason for this switch is so I can create both amd64 and arm64 images - the latter is useful for those running Docker on M1 Macs. \n\nMicrosoft [does not support](https://learn.microsoft.com/en-us/powershell/scripting/install/install-ubuntu?view=powershell-7.4#supported-versions) arm64 on Ubuntu. There's no mention of arm64 with Linux anywhere actually, but I found the CBL Mariner images so I figure it is supported. ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakheshster%2Fdocker-powershell-msgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frakheshster%2Fdocker-powershell-msgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakheshster%2Fdocker-powershell-msgraph/lists"}