Cannot connect to Azure File Share - azure

Created Azure file share in portal and copied the PowerShell script to connect it as drive Q: (verified not in use). Response:
New-PSDrive : The network resource type is not correct
At line:3 char:1
+ New-PSDrive -Name Q -PSProvider FileSystem -Root "\\xxxx.file.c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Q:PSDriveInfo) [New-PSDrive], Win32Exception
+ FullyQualifiedErrorId : CouldNotMapNetworkDrive,Microsoft.PowerShell.Commands.NewPSDriveCommand
where "xxxx" is the share name. The PS command was copied directly from the portal and not altered.

As noted in comments above, Comcast blocks port 445. Solution was to have another object in the cloud reference the Azure File and then return the data to the client over HTTP.

Several workaround for port 445 (SMB port) being blocked are listed here:
https://learn.microsoft.com/en-us/azure/storage/files/storage-troubleshoot-windows-file-connection-problems#error-53-error-67-or-error-87-when-you-mount-or-unmount-an-azure-file-share

Related

Why can't AzureRmAks find SSH key when deploying new Kubernetes cluster?

Last night I used PowerShell to deploy a Kubernetes cluster on AKS with something like this:
New-AzureRmAks -ResourceGroupName "my-rg" -Name "my-aks-cluster" -KubernetesVersion "1.16.13" -NodeCount 2 -NodeVmSize "Standard_DS2_V2" -Verbose
This worked fine. Today, however, I tried this same thing in a different subscription, but keep getting the following error:
VERBOSE: Cluster does not exist.
VERBOSE: Cluster is new.
VERBOSE: Performing the operation "Creating a managed Kubernetes cluster." on target "my-aks-cluster in my-rg".
VERBOSE: Preparing for deployment of your managed Kubernetes cluster.
VERBOSE: Using location eastus from the resource group my-rg.
VERBOSE: Using DNS name prefix my-aks-cluster-my-rg-dcdf2a.
VERBOSE: Fetching SSH public key from file C:\Users\myuser\.ssh\id_rsa.pub
New-AzureRmAks : The given key was not present in the dictionary.
At line:1 char:1
+ New-AzureRmAks -ResourceGroupName "my-reg" -Name "my-aks-cluster" -Kube ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmAks], KeyNotFoundException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Aks.NewAzureRmAks
I'm confused because:
This same command worked earlier
I have same admin rights to new subscription as to the one previously used
The path to the key is valid
The key, id_rsa.pub, is at the path listed
Anyone have an idea what is going on here? Any tips are appreciated.
I can reproduce this issue with the same user account when only changing to a new subscription in another directory.
To fix it, you can delete all files but leave TokenCache.dat file in the .Azure folder of the path
C:\Users\myuser\.Azure
Then re-connect the subscription.
Edit
In this case, deleting the file acsServicePrincipal under the local .azure directory is to fix this issue.

Azure AD Sync Could not Load File

I'm having a really weird issue. I'm unable to import the Azure AD Sync module.
Here's what I've tried:
Import-Module ADSync
Import-Module "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync\ADSync.psd1"
I'm getting the following error:
Import-module : Could not load file or assembly 'file:///C:\Program
Files\Microsoft Azure AD
Sync\Bin\Microsoft.Azure.ActiveDirectory.Synchronization.ProvisioningWebServiceAdapter.dll'
or one of its dependencies. An attempt was made to load a program
with an incorrect format. At line:1 char:1
+ Import-module adsync
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], BadImageFormatException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
I'm running under the following premise:
Azure AD Connect 1.2.70
Powershell 4.0
Windows Server 2012R2
The account I'm using is a Domain Admin and should have full permissions. I'm RDPing into the server. I'm also running Powershell as an Administrator. I've checked all installations and frameworks and they are either up to date or not applicable. AD sync is running just fine, I'm just trying to get the powershell CMDlets to work so that I can add them to a script I'm writing.
UPDATE: See below answers for solution. Reinstalling AAD was the solution.
Was able to import the module using below command, please try it out.
Import-Module –Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" -Verbose
Additional Documentation Reference for:
Download
Version
Automatic Upgrade
Hope this helps.

Unable to create client VM that access Azure Sql Managed Instance due to core quota limit

I have create Azure SQL Managed Instance and I want to create client VM that will be used to access the instance. I have copied the configuration script from the Azure portal:
When I execute this script via PowerShell, I'm getting the following error:
New-AzureRmResourceGroupDeployment : 5:06:13 PM - Error: Code=InvalidTemplateDeployment; Message=The template deployment 'azuredeploy' is not valid according to the
validation procedure. The tracking id is '8bc76e8d-3070-44a3-bc43-58bbeeac20d8'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.
At line:179 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : 5:06:14 PM - Error: Code=QuotaExceeded; Message=Operation results in exceeding quota limits of Core. Maximum allowed: 100, Current
in use: 100, Additional requested: 2. Please read more about quota increase at http://aka.ms/corequotaincrease.
At line:179 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
If these some explanation why this error happens and hot to see what is the current quota?
The first error shows that you have InvalidTemplateDeployment. You could execute this script with Invoke-Command here to run commands on local and remote computers. Once you copy this script to your power shell command line, you would need to set the password for VM and execute the script. Once you execute the script, you will see that it deployed your VM. You can get more details from this step by step.
For the second error. The quota is for each individual region, not for the entire subscription. You can use the Get-AzureRmVMUsage -Location "South Central US" command to find virtual machine quotas with a specific location. You can get more reference about resolving errors for resource quotas.

Deploying a forked repro of an azure quick start template

newbie at Github.
I have forked the repro of Azure Quickstart Templates and changed the "install_lamp_moodle.sh" for the "moodle-singlevm-ubuntu" to fit my needs but I cant seem to be able to test this as every-time the newuserscript part of the azuredeploy.json template (which I have locally stored), fails
I have changed the path to the installscript URI from:
"installScriptUri": "[concat('https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]",`
to
"installScriptUri": "[concat('https://github.com/albertramsbottom/azure-quickstart-templates/blob/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]",
And I am using Azure power-shell to create the resource Group and run the template
fails every time on a 404 error for the newuserscript
Obviously doing something very silly here. As I do not know Github I dont want to make changes to anything and thought that by forking the repro I could attempt this. And I have no idea where is newuserscript lives, I assume its an extension for Linux.
New-AzureRmResourceGroupDeployment : 08:56:02 - Resource Microsoft.Compute/virtualMachines/extensions
'myVM/newuserscript' failed with message 'The resource operation completed with terminal
provisioning state 'Failed'.'At line:1 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName mygroup -TemplateFile C:\T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand
New-AzureRmResourceGroupDeployment : 08:56:02 - VM has reported a failure when processing extension 'newuserscript'.
Error message: "Script returned an error.
---stdout---
---errout---
install_lamp_moodle.sh: 6: install_lamp_moodle.sh: Syntax error: newline unexpected
".At line:1 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName mygroup -TemplateFile C:\T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand
I know this sounds like an Azure quickstart issue but I think it is really a lack of understanding of GitHub and how to use a forked repro
And I aslo assume this has noting to do with the moodle-singlevm-ubuntu template and has more to do with my idiocy :)
Sorry #
You want to link to the "raw" file URI like in the original template. So something like:
"installScriptUri": "[concat('https://raw.githubusercontent.com/albertramsbottom/azure-quickstart-templates/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]"
Note that that location has to be publicly accessible. For a model on how to stage artifacts in a private location you can take a look at this repo:
https://github.com/bmoore-msft/AzureRM-Samples

Vmware VM move from one host to other host via PowerCLI

Hi we have 6 Vspher server and my Vcenter is Linux Based and version is Vsphere 5.5 .
We are trying manage our VMware environment automatically via PowerCLI script .
I got a script on internet but getting error . Thanks to Lucd and Kunaludapi for helping.
Need some help on this.
Move-VM : Cannot convert 'System.Object[]' to the type 'VMware.VimAutomation.Vi
Core.Types.V1.Inventory.VIContainer' required by parameter 'Destination'. Speci
fied method is not supported.
At C:\Scheduled tasks\Vmware DRS Script.ps1:103 char:53
+ $objVM | move-vm -destination <<<< (get-vmhost $strDe
st);
+ CategoryInfo : InvalidArgument: (:) [Move-VM], ParameterBinding
Exception
+ FullyQualifiedErrorId : CannotConvertArgument,VMware.VimAutomation.ViCor
e.Cmdlets.Commands.MoveVM
google is your friend
http://kc-tek.blogspot.co.nz/2012/06/vmotion-vms-from-one-given-host-to.html
As always when using PowerCLI you have to connect to your vCentre server
Connect-VIserver SeverName
Issue the command to 'get' the VMs from the host you want to move them off and then 'move' them to the target host.
Get-VM -Location "HostName" | Move-VM -Destination (Get-Vmhost "NewHost")

Resources