Loading...

Create an Azure file share to upload files from Intune or other


In this post I will show you a way to create an Azure file share that allows you to upload files (like ZIP logs) on Azure.
I will explain how to upload those files on the Azure file share through intune.

Context
Troubleshooting things relative to Intune (enrollment, deployment...) on devices may be difficult because you have to check them on the device directly.
In a previous post I explained how to collect logs on the device, create a ZIP, then upload the ZIP on AZure file share.
Now I will explain the first step, how to create the AZure file share for the upload part.

Prerequisites
- You need an Azure subsciption
- Access to Azure Active Directory
- You need an Intune licence for our tests

How it works ?
This will work in 3 steps:
- Create a resource Group
- Create a storage account
- Create a storage file share
- Create a certificate
- Create an Azure App registration with certificate
- Export the certicate
- Import certifcate on devices

Now let's see how to do this.

Create Azure content
We will see hwo to to the below parts:
- Create a resource Group
- Create a storage account
- Create a storage file share

Resource group and storage account
1. In the Azure portal, go to Storage accounts

2. Click on Create storage account

3. Select your subscription and resource group
4. If there is no resource group, click on Create new

5. Type a name (in my case SD_ResourceGroup
6. Click on OK 

7. Type a Store account name (in my case sdaccountname)
8. Select location and choose performance

9. Click on Review + create

10. Click on Create
11. The below notification will be displayed


Storage file share
1. Click on go to resource
2. Click on File shares

3. Click on + File share

4. Type a name (in my case intunelogs)
5. Click on Create

6. The below notification will be displayed

7. Your File share is available

8. Click on it, it will be empty

Create certificate and Azure app
We will now see the below parts:
- Create a certificate
- Create an Azure App registration with certificate

We will create a certificate from device and create an Azure app registration with this certificate.
1. See below the script to create the certificate:
2. Install module Az using the below command:
3. Connect to your tenant using the below cmdlet:
4. Type your credentils in the web prompt
5. Create the Azure app using the below script:

Certificate on other devices
We will now see the below parts:
- Export the certicate
- Import certifcate on devices

1. To export the certificate from the device, use the below code:
2. To import it on other devices, use the below code:

Note: In my tests I added the cert in an intunewin and import the cert in the main script

Upload file to Azure file share
In this example we will import a ZIP file.
We will need tenant id, application id and thumbprint.
For that proceed as below:
1. Go Azure Active Directory
2. Go to App registrations
3. Click on the created app

4. You will find the app id
5. Go to Certificates & secrets
6. You will find the thumbprint

Now see how to upload a file:
1. Install module Az using below cmdlet:
2. Import the certificate using the below code:
3. Connect to Azure using the certificate, as below:
4. Upload the ZIP using the below code:
6. See below the Azure file share after the upload
slider 4919797776967678873

Publier un commentaire

Accueil item

Award

Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR

Stats