Skip to main content

Posts

Azure - Set up internet connectivity for the guest virtual machine

Here is the link Here is the text Create a NAT virtual network switch New-VMSwitch -Name "InternalNATSwitch" -SwitchType Internal View the properties of the switch and note the ifIndex for the new adapter. Get-NetAdapter Create an IP address for the NAT Gateway. New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex 13 where  InterfaceIndex -  ifIndex  is the interface index of the virtual switch created in the previous step Create the NAT network New-NetNat -Name "InternalNat" -InternalIPInterfaceAddressPrefix 192.168.0.0/24 Create the guest virtual machine Configure the virtual machine to use the new Internal network you created.  Configure DHCP to dynamically assign an IP address to the guest virtual machine Install DCHP Server on the Azure VM Configure a new DHCP scope Define an IP Range for your DCHP Server (for example, 192.168.0.100 to 192.168.0.200) Click  Next ...

Swap Disk for Azure VM

$resourceGroupName = 'rg-OMS' $location = 'eastus2' $vmName = 'x007' $snapshotName = 'snapX007disk'  $diskAccountType='Premium_LRS' $osDiskName = 'newX007fromSnapshot' $vm = get-azurermvm  -ResourceGroupName $resourceGroupName   -Name $vmName $snapshot =  New-AzureRmSnapshotConfig   -SourceUri $vm.StorageProfile.OsDisk.ManagedDisk.Id   -Location $location   -CreateOption copy -SkuName $diskAccountType # create a snapshot New-AzureRmSnapshot -Snapshot $snapshot -SnapshotName $snapshotName -ResourceGroupName $resourceGroupName $snapshot = Get-AzureRmSnapshot -ResourceGroupName $resourceGroupName -SnapshotName $snapshotName $diskConfig = New-AzureRmDiskConfig -Location $snapshot.Location -SourceResourceId $snapshot.Id -CreateOption Copy -SkuName $diskAccountType $disk = New-AzureRmDisk -Disk $diskConfig -ResourceGroupName $resourceGroupName -DiskName $osDiskName # list all disks Get-AzureRmDisk -ResourceGroupNa...

Azure Automation Script - Process Tabular Model in Azure Analysis Services

workflow ProcessTabularModel {    param         (             # Fully-qualified name of the Azure AS server             [parameter(Mandatory=$true)]             [string] $AzureASName = "asazure://xxxxxxx.asazure.windows.net/yyyyyyyyy",             # DB Name             [parameter(Mandatory=$true)]             [string] $DataBaseName = "zzzzzzzz",             # Credentials for $AzureASName stored as an Azure Automation credential asset             # When using in the Azure Automation UI, please enter the name of the credential asset for the "Credential" parameter             [parameter(Mandatory=$true)]             [PSCredential] $AzureASCredential ...

Generate Calendar Table in Power BI with Fiscal Year Attributes

In Power BI go to Get Data --> Blank Query and paste into the Function windows the text below. This function takes as parameters: - StartYear (e.g., 2012) - EndYear (e.g., 2018) -FiscalYearStartMonth (e.g., 4) And it will generate a calendar table for dates from Jan-1-<StartYear> till Dec-31-<EndYear> and columns for Fiscal Year, Fiscal Month, Fiscal Quarter, Fiscal Year Day where the Fiscal year begins on FiscalYearStartMonth = (StartYear as number, EndYear as number, FiscalYearStartMonth as number)=> let     //Capture the date range from the parameters     StartDate = #date(StartYear, 1, 1),     EndDate = #date(EndYear, 12, 31), //Get the number of dates that will be required for the table     GetDateCount = Duration.Days(EndDate - StartDate)+1, //Take the count of dates and turn it into a list of dates     GetDateList = List.Dates(StartDate, GetDateCount,  ...

Find All Azure DBs where a table is missing

Import-Module "SqlServer" $fullsqlsrv='myservername.database.windows.net' $sa='myadmin' $sapwd='mypassword' $connStr = "Server = $fullSqlSrv ; Database = master; User ID=$sa;Password=$sapwd" $connection = New-Object Microsoft.SqlServer.Management.Common.ServerConnection $connection.ConnectionString = $connStr $connection.Connect() $server = New-Object Microsoft.SqlServer.Management.Smo.Server($connection) $allDBs= $server.Databases foreach ($db in $alldbs){     if (!($db.tables.Name -contains 'cspCompany')) {"$($db.name) has no CSpCompany"}     }